]> granicus.if.org Git - llvm/commitdiff
[ARM] Select fp16 fabs
authorDavid Green <david.green@arm.com>
Sun, 26 May 2019 10:51:58 +0000 (10:51 +0000)
committerDavid Green <david.green@arm.com>
Sun, 26 May 2019 10:51:58 +0000 (10:51 +0000)
This adds a pattern for the fabs intrinsic, the same as float and double.

Differential Revision: https://reviews.llvm.org/D62324

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361715 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMInstrVFP.td
test/CodeGen/ARM/fp16-fullfp16.ll

index 17f954ef7ddb625b8b1c6be7ffac7d570bc6cbb4..1f497f6d5bff86d8dae6b45ce89e94ea5d3e2853 100644 (file)
@@ -595,9 +595,9 @@ def VABSS  : ASuIn<0b11101, 0b11, 0b0000, 0b11, 0,
 }
 
 def VABSH  : AHuI<0b11101, 0b11, 0b0000, 0b11, 0,
-                   (outs SPR:$Sd), (ins SPR:$Sm),
+                   (outs HPR:$Sd), (ins HPR:$Sm),
                    IIC_fpUNA16, "vabs", ".f16\t$Sd, $Sm",
-                   []>;
+                   [(set HPR:$Sd, (fabs (f16 HPR:$Sm)))]>;
 
 let Defs = [FPSCR_NZCV] in {
 def VCMPEZD : ADuI<0b11101, 0b11, 0b0101, 0b11, 0,
index e4a8fa75504faae4131fee76fdc16d0897b12ed2..7e8369be740f866673428265f5f9e815e2d132fa 100644 (file)
@@ -312,13 +312,17 @@ define void @test_sqrt(half* %p) {
 ;  ret void
 ;}
 
-; FIXME
-;define void @test_fabs(half* %p) {
-;  %a = load half, half* %p, align 2
-;  %r = call half @llvm.fabs.f16(half %a)
-;  store half %r, half* %p
-;  ret void
-;}
+define void @test_fabs(half* %p) {
+; CHECK-LABEL: test_fabs:
+; CHECK:         vldr.16 s0, [r0]
+; CHECK-NEXT:    vabs.f16 s0, s0
+; CHECK-NEXT:    vstr.16 s0, [r0]
+; CHECK-NEXT:    bx lr
+  %a = load half, half* %p, align 2
+  %r = call half @llvm.fabs.f16(half %a)
+  store half %r, half* %p
+  ret void
+}
 
 define void @test_minnum(half* %p, half* %q) {
 ; CHECK-LABEL: test_minnum: