From bf8e161bd97bf06d7c1d35a4d14034836606184b Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Thu, 21 Apr 2016 21:02:25 +0000 Subject: [PATCH] add tests for disguised fabs/fneg git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267053 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/AArch64/fcvt-int.ll | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/CodeGen/AArch64/fcvt-int.ll b/test/CodeGen/AArch64/fcvt-int.ll index d549c7e7842..9092bea8c2a 100644 --- a/test/CodeGen/AArch64/fcvt-int.ll +++ b/test/CodeGen/AArch64/fcvt-int.ll @@ -149,3 +149,32 @@ define double @test_bitcasti64todouble(i64 %in) { ret double %res } + +define double @bitcast_fabs(double %x) { +; CHECK-LABEL: bitcast_fabs: +; CHECK: ; BB#0: +; CHECK-NEXT: fmov x8, d0 +; CHECK-NEXT: and x8, x8, #0x7fffffffffffffff +; CHECK-NEXT: fmov d0, x8 +; CHECK-NEXT: ret +; + %bc1 = bitcast double %x to i64 + %and = and i64 %bc1, 9223372036854775807 + %bc2 = bitcast i64 %and to double + ret double %bc2 +} + +define float @bitcast_fneg(float %x) { +; CHECK-LABEL: bitcast_fneg: +; CHECK: ; BB#0: +; CHECK-NEXT: fmov w8, s0 +; CHECK-NEXT: eor w8, w8, #0x80000000 +; CHECK-NEXT: fmov s0, w8 +; CHECK-NEXT: ret +; + %bc1 = bitcast float %x to i32 + %xor = xor i32 %bc1, 2147483648 + %bc2 = bitcast i32 %xor to float + ret float %bc2 +} + -- 2.11.0