Improve chances of folding to LEA patterns
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/X86/X86InstrCompiler.td | ||
---|---|---|
1521 | I'm not sure the "If safe" is needed here. I think this was copied from or_is_add where "safe" meant checking known bits. Here you explicitly wrote min_signed_value so there's nothing additional to check. | |
1525 | Drop curly braces? You could even write ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N->getOperand(1)); return CN && CN->isMinSignedValue() |
llvm/lib/Target/X86/X86InstrCompiler.td | ||
---|---|---|
1529 | It occurs to me you could avoid the AddedComplexity by writing def : Pat<(xor GR8:$src1, 128), (ADD8ri GR8:$src1, 128)>; def : Pat<(xor GR16:$src1, 32768), (ADD16ri GR16:$src1, 32768)>; def : Pat<(xor GR32:$src1, 2147483648), (ADD32ri GR32:$src1, 2147483648)>; |
llvm/lib/Target/X86/X86InstrCompiler.td | ||
---|---|---|
1529 | Those might need to be negative constants. |
I'm not sure the "If safe" is needed here. I think this was copied from or_is_add where "safe" meant checking known bits. Here you explicitly wrote min_signed_value so there's nothing additional to check.