summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AArch64/sqrt-fastmath.ll
diff options
context:
space:
mode:
authorEvandro Menezes <e.menezes@samsung.com>2016-07-19 22:31:11 +0000
committerEvandro Menezes <e.menezes@samsung.com>2016-07-19 22:31:11 +0000
commit238fa76574be7f2ee88383ca377fb8f3ed587951 (patch)
treeb4eef7f2ab827f5373d6f6dc732424b406cdf52a /llvm/test/CodeGen/AArch64/sqrt-fastmath.ll
parent5d2ea9dcf8a0f7ecc74153afd35ea782af5f1b86 (diff)
downloadbcm5719-llvm-238fa76574be7f2ee88383ca377fb8f3ed587951.tar.gz
bcm5719-llvm-238fa76574be7f2ee88383ca377fb8f3ed587951.zip
[AArch64] Properly validate the reciprocal estimation.
Add check for legal data types when expanding into a Newton series. Differential Revision: https://reviews.llvm.org/D22267 llvm-svn: 276041
Diffstat (limited to 'llvm/test/CodeGen/AArch64/sqrt-fastmath.ll')
-rw-r--r--llvm/test/CodeGen/AArch64/sqrt-fastmath.ll78
1 files changed, 74 insertions, 4 deletions
diff --git a/llvm/test/CodeGen/AArch64/sqrt-fastmath.ll b/llvm/test/CodeGen/AArch64/sqrt-fastmath.ll
index 0d9533fd27f..962c7d80a65 100644
--- a/llvm/test/CodeGen/AArch64/sqrt-fastmath.ll
+++ b/llvm/test/CodeGen/AArch64/sqrt-fastmath.ll
@@ -1,13 +1,15 @@
-; RUN: llc < %s -mtriple=aarch64 -mattr=neon -recip=!sqrt,!vec-sqrt | FileCheck %s --check-prefix=FAULT
-; RUN: llc < %s -mtriple=aarch64 -mattr=neon -recip=sqrt,vec-sqrt | FileCheck %s
-; RUN: llc < %s -mtriple=aarch64 -mattr=neon,-use-reverse-square-root | FileCheck %s --check-prefix=FAULT
+; RUN: llc < %s -mtriple=aarch64 -mattr=neon -recip=!sqrt,!vec-sqrt | FileCheck %s --check-prefix=FAULT
+; RUN: llc < %s -mtriple=aarch64 -mattr=neon,-use-reverse-square-root | FileCheck %s --check-prefix=FAULT
+; RUN: llc < %s -mtriple=aarch64 -mattr=neon -recip=sqrt,vec-sqrt | FileCheck %s
; RUN: llc < %s -mtriple=aarch64 -mattr=neon,+use-reverse-square-root | FileCheck %s
declare float @llvm.sqrt.f32(float) #1
-declare double @llvm.sqrt.f64(double) #1
declare <2 x float> @llvm.sqrt.v2f32(<2 x float>) #1
declare <4 x float> @llvm.sqrt.v4f32(<4 x float>) #1
+declare <8 x float> @llvm.sqrt.v8f32(<8 x float>) #1
+declare double @llvm.sqrt.f64(double) #1
declare <2 x double> @llvm.sqrt.v2f64(<2 x double>) #1
+declare <4 x double> @llvm.sqrt.v4f64(<4 x double>) #1
define float @fsqrt(float %a) #0 {
%1 = tail call fast float @llvm.sqrt.f32(float %a)
@@ -53,6 +55,23 @@ define <4 x float> @f4sqrt(<4 x float> %a) #0 {
; CHECK-NEXT: frsqrte
}
+define <8 x float> @f8sqrt(<8 x float> %a) #0 {
+ %1 = tail call fast <8 x float> @llvm.sqrt.v8f32(<8 x float> %a) #2
+ ret <8 x float> %1
+
+; FAULT-LABEL: f8sqrt:
+; FAULT-NEXT: BB#0
+; FAULT-NEXT: fsqrt
+; FAULT-NEXT: fsqrt
+
+; CHECK-LABEL: f8sqrt:
+; CHECK-NEXT: BB#0
+; CHECK-NEXT: fmov
+; CHECK-NEXT: mov
+; CHECK-NEXT: frsqrte
+; CHECK: frsqrte
+}
+
define double @dsqrt(double %a) #0 {
%1 = tail call fast double @llvm.sqrt.f64(double %a)
ret double %1
@@ -82,6 +101,23 @@ define <2 x double> @d2sqrt(<2 x double> %a) #0 {
; CHECK-NEXT: frsqrte
}
+define <4 x double> @d4sqrt(<4 x double> %a) #0 {
+ %1 = tail call fast <4 x double> @llvm.sqrt.v4f64(<4 x double> %a) #4
+ ret <4 x double> %1
+
+; FAULT-LABEL: d4sqrt:
+; FAULT-NEXT: BB#0
+; FAULT-NEXT: fsqrt
+; FAULT-NEXT: fsqrt
+
+; CHECK-LABEL: d4sqrt:
+; CHECK-NEXT: BB#0
+; CHECK-NEXT: fmov
+; CHECK-NEXT: mov
+; CHECK-NEXT: frsqrte
+; CHECK: frsqrte
+}
+
define float @frsqrt(float %a) #0 {
%1 = tail call fast float @llvm.sqrt.f32(float %a)
%2 = fdiv fast float 1.000000e+00, %1
@@ -127,6 +163,23 @@ define <4 x float> @f4rsqrt(<4 x float> %a) #0 {
; CHECK-NEXT: frsqrte
}
+define <8 x float> @f8rsqrt(<8 x float> %a) #0 {
+ %1 = tail call fast <8 x float> @llvm.sqrt.v8f32(<8 x float> %a) #2
+ %2 = fdiv fast <8 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, %1
+ ret <8 x float> %2
+
+; FAULT-LABEL: f8rsqrt:
+; FAULT-NEXT: BB#0
+; FAULT-NEXT: fsqrt
+; FAULT-NEXT: fsqrt
+
+; CHECK-LABEL: f8rsqrt:
+; CHECK-NEXT: BB#0
+; CHECK-NEXT: fmov
+; CHECK-NEXT: frsqrte
+; CHECK: frsqrte
+}
+
define double @drsqrt(double %a) #0 {
%1 = tail call fast double @llvm.sqrt.f64(double %a)
%2 = fdiv fast double 1.000000e+00, %1
@@ -157,4 +210,21 @@ define <2 x double> @d2rsqrt(<2 x double> %a) #0 {
; CHECK-NEXT: frsqrte
}
+define <4 x double> @d4rsqrt(<4 x double> %a) #0 {
+ %1 = tail call fast <4 x double> @llvm.sqrt.v4f64(<4 x double> %a) #4
+ %2 = fdiv fast <4 x double> <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>, %1
+ ret <4 x double> %2
+
+; FAULT-LABEL: d4rsqrt:
+; FAULT-NEXT: BB#0
+; FAULT-NEXT: fsqrt
+; FAULT-NEXT: fsqrt
+
+; CHECK-LABEL: d4rsqrt:
+; CHECK-NEXT: BB#0
+; CHECK-NEXT: fmov
+; CHECK-NEXT: frsqrte
+; CHECK: frsqrte
+}
+
attributes #0 = { nounwind "unsafe-fp-math"="true" }
OpenPOWER on IntegriCloud