1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[ARM] Fix issue with large xor constants.

Fixup to rL325573 for large xor constants.

Thanks to Eli Friedman for the catch.

Differential revision: https://reviews.llvm.org/D43549

llvm-svn: 325761
This commit is contained in:
David Green 2018-02-22 09:38:57 +00:00
parent 5d83896911
commit 86bf0a6446
2 changed files with 31 additions and 5 deletions

View File

@ -127,11 +127,8 @@ int ARMTTIImpl::getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm,
}
// 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);
}

View File

@ -191,3 +191,32 @@ for.cond.cleanup:
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
}