[PATCH] D43549: [ARM] Fix issue with large xor constants.
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 01:41:35 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL325761: [ARM] Fix issue with large xor constants. (authored by dmgreen, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D43549?vs=135205&id=135377#toc
Repository:
rL LLVM
https://reviews.llvm.org/D43549
Files:
llvm/trunk/lib/Target/ARM/ARMTargetTransformInfo.cpp
llvm/trunk/test/CodeGen/Thumb/mvn.ll
Index: llvm/trunk/lib/Target/ARM/ARMTargetTransformInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ llvm/trunk/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -127,11 +127,8 @@
}
// xor a, -1 can always be folded to MVN
- if (Opcode == Instruction::Xor) {
- int64_t NegImm = Imm.getSExtValue();
- if (NegImm == -1)
- return 0;
- }
+ if (Opcode == Instruction::Xor && Imm.isAllOnesValue())
+ return 0;
return getIntImmCost(Imm, Ty);
}
Index: llvm/trunk/test/CodeGen/Thumb/mvn.ll
===================================================================
--- llvm/trunk/test/CodeGen/Thumb/mvn.ll
+++ llvm/trunk/test/CodeGen/Thumb/mvn.ll
@@ -191,3 +191,32 @@
ret void
}
+
+define void @test128(i128* %a) {
+; CHECK-LABEL: test128:
+; CHECK: ldr r1, [r0, #4]
+; CHECK-NEXT: ldr r2, .LCPI8_0
+; CHECK-NEXT: eors r2, r1
+; CHECK-NEXT: str r2, [r0, #4]
+; CHECK-NEXT: ldr r1, [r0]
+; CHECK-NEXT: ldr r2, .LCPI8_1
+; CHECK-NEXT: eors r2, r1
+; CHECK-NEXT: str r2, [r0]
+; CHECK-NEXT: ldr r1, [r0, #8]
+; CHECK-NEXT: ldr r2, .LCPI8_2
+; CHECK-NEXT: eors r2, r1
+; CHECK-NEXT: str r2, [r0, #8]
+; CHECK-NEXT: bx lr
+; CHECK-NEXT: .p2align 2
+; CHECK-NEXT: .LCPI8_0:
+; CHECK-NEXT: .long 4075008415
+; CHECK-NEXT: .LCPI8_1:
+; CHECK-NEXT: .long 2080661269
+; CHECK-NEXT: .LCPI8_2:
+; CHECK-NEXT: .long 6692605
+ %x = load i128, i128* %a
+ %xn = xor i128 %x, 123456789123456789123456789
+ store i128 %xn, i128* %a
+ ret void
+}
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43549.135377.patch
Type: text/x-patch
Size: 1597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180222/4e633fff/attachment.bin>
More information about the llvm-commits
mailing list