Closed Quuxplusone closed 3 years ago
Bugzilla Link | PR47603 |
Status | RESOLVED FIXED |
Importance | P enhancement |
Reported by | Tom Hender (ToHe_EMA@gmx.de) |
Reported on | 2020-09-21 09:49:50 -0700 |
Last modified on | 2021-04-05 03:57:49 -0700 |
Version | trunk |
Hardware | PC All |
CC | craig.topper@gmail.com, htmldeveloper@gmail.com, lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, pengfei.wang@intel.com, spatel+llvm@rotateright.com |
Fixed by commit(s) | rG89afec348dbd3e5078f176e978971ee2d3b5dec8, rG36d4f6d7f8ad08bb99da544f2b6ca96e34977839 |
Attachments | |
Blocks | |
Blocked by | |
See also |
SelectionDAG has 13 nodes:
t0: ch = EntryToken
t2: i32,ch = CopyFromReg t0, Register:i32 %0
t11: i32,i32 = X86ISD::BSR t2
t13: i32 = xor t11, Constant:i32<31>
t4: i8 = truncate t13
t6: i8 = xor t4, Constant:i8<31>
t9: ch,glue = CopyToReg t0, Register:i8 $al, t6
t10: ch = X86ISD::RET_FLAG t9, TargetConstant:i32<0>, Register:i8 $al, t9:1
We limit trunc(xor(x,y)) -> xor(trunc(x),trunc(y)) folds to pre-legalization, I
suppose we could handle this in the X86 backend as the CTLZ/BSR+XOR case is
relatively common when we don't have LZCNT?
Reopening, the second case is still as bad as ever:
(In reply to Simon Pilgrim from comment #2)
> Reopening, the second case is still as bad as ever:
>
> https://gcc.godbolt.org/z/Kc4GWEqnh
Should be fixed by rG36d4f6d7f8ad08bb99da544f2b6ca96e34977839