-
Notifications
You must be signed in to change notification settings - Fork 261
Open
Open
Enhancement
Copy link
Labels
Component: CoreIssue needs changes to the coreIssue needs changes to the coreCore: DataflowRelated to the Possible Value Set and Register Value systemsRelated to the Possible Value Set and Register Value systemsCore: HLILIssue involves High Level ILIssue involves High Level ILCore: MLILIssue involves Medium Level ILIssue involves Medium Level ILEffort: TrivialIssues require < 1 day of workIssues require < 1 day of workIL OptimizationIssue involving optimization of representation (not correctness)Issue involving optimization of representation (not correctness)Impact: LowIssue is a papercut or has a good, supported workaroundIssue is a papercut or has a good, supported workaround
Milestone
Description
What is the feature you'd like to have?
Constant-folding inside of IL_MUL(U)_DP, AFAIK currently it's not supported(?)
Is your feature request related to a problem?
not much
Are any alternative solutions acceptable?
Well, i can override arch plugin to change lifting in such way its won't use MUL_DP but it looks like overkill to me.
Additional Information:
Example code for arm64:
#include <stdint.h>
#include <stdio.h>
__attribute__((always_inline))
uint64_t mymul(uint32_t a, uint32_t b) {
uint64_t result = 0;
__asm volatile (
"umull %x[res], %w[first], %w[second]"
: [res] "=r" (result)
: [first] "r" (a), [second] "r" (b)
);
return result;
}
int main() {
if (mymul(5, 3) == 15) {
puts("15 indeed");
} else {
puts("pls, hide me out :C");
}
return 0;
}This snippet uses umull instruction, with a pretty trivial case that can be folded (two constant integers), however here is how it looks like in MLIL and HLIL:
Here is the binary i've tested on:
umull_test.zip
Metadata
Metadata
Assignees
Labels
Component: CoreIssue needs changes to the coreIssue needs changes to the coreCore: DataflowRelated to the Possible Value Set and Register Value systemsRelated to the Possible Value Set and Register Value systemsCore: HLILIssue involves High Level ILIssue involves High Level ILCore: MLILIssue involves Medium Level ILIssue involves Medium Level ILEffort: TrivialIssues require < 1 day of workIssues require < 1 day of workIL OptimizationIssue involving optimization of representation (not correctness)Issue involving optimization of representation (not correctness)Impact: LowIssue is a papercut or has a good, supported workaroundIssue is a papercut or has a good, supported workaround