-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
Description
| Bugzilla Link | 46234 |
| Version | trunk |
| OS | Linux |
| CC | @RKSimon,@nikic,@rotateright |
Extended Description
int src(long int num) {
num &= 0xFFFFFFF;
return num >> 2;
}
int tgt(long int num) {
return (((unsigned int)num) << 4) >> 6;
}
define i32 @src(i64 %0) {
%1:
%2 = lshr i64 %0, 2
%3 = trunc i64 %2 to i32
%4 = and i32 %3, 67108863
ret i32 %4
}
=>
define i32 @tgt(i64 %0) {
%1:
%2 = trunc i64 %0 to i32
%3 = lshr i32 %2, 2
%4 = and i32 %3, 67108863
ret i32 %4
}
Transformation seems to be correct!
https://godbolt.org/z/V7xRAy
^ we do that in backend, but not middle-end.