1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
; 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,+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 <2 x double> @llvm.sqrt.v2f64(<2 x double>) #1
define float @fsqrt(float %a) #0 {
%1 = tail call fast float @llvm.sqrt.f32(float %a)
ret float %1
; FAULT-LABEL: fsqrt:
; FAULT-NEXT: BB#0
; FAULT-NEXT: fsqrt
; CHECK-LABEL: fsqrt:
; CHECK-NEXT: BB#0
; CHECK-NEXT: fmov
; CHECK-NEXT: frsqrte
}
define <2 x float> @f2sqrt(<2 x float> %a) #0 {
%1 = tail call fast <2 x float> @llvm.sqrt.v2f32(<2 x float> %a) #2
ret <2 x float> %1
; FAULT-LABEL: f2sqrt:
; FAULT-NEXT: BB#0
; FAULT-NEXT: fsqrt
; CHECK-LABEL: f2sqrt:
; CHECK-NEXT: BB#0
; CHECK-NEXT: fmov
; CHECK-NEXT: mov
; CHECK-NEXT: frsqrte
}
define <4 x float> @f4sqrt(<4 x float> %a) #0 {
%1 = tail call fast <4 x float> @llvm.sqrt.v4f32(<4 x float> %a) #2
ret <4 x float> %1
; FAULT-LABEL: f4sqrt:
; FAULT-NEXT: BB#0
; FAULT-NEXT: fsqrt
; CHECK-LABEL: f4sqrt:
; CHECK-NEXT: BB#0
; CHECK-NEXT: fmov
; CHECK-NEXT: mov
; CHECK-NEXT: frsqrte
}
define double @dsqrt(double %a) #0 {
%1 = tail call fast double @llvm.sqrt.f64(double %a)
ret double %1
; FAULT-LABEL: dsqrt:
; FAULT-NEXT: BB#0
; FAULT-NEXT: fsqrt
; CHECK-LABEL: dsqrt:
; CHECK-NEXT: BB#0
; CHECK-NEXT: fmov
; CHECK-NEXT: frsqrte
}
define <2 x double> @d2sqrt(<2 x double> %a) #0 {
%1 = tail call fast <2 x double> @llvm.sqrt.v2f64(<2 x double> %a) #2
ret <2 x double> %1
; FAULT-LABEL: d2sqrt:
; FAULT-NEXT: BB#0
; FAULT-NEXT: fsqrt
; CHECK-LABEL: d2sqrt:
; CHECK-NEXT: BB#0
; CHECK-NEXT: fmov
; CHECK-NEXT: mov
; CHECK-NEXT: 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
ret float %2
; FAULT-LABEL: frsqrt:
; FAULT-NEXT: BB#0
; FAULT-NEXT: fsqrt
; CHECK-LABEL: frsqrt:
; CHECK-NEXT: BB#0
; CHECK-NEXT: fmov
; CHECK-NEXT: frsqrte
}
define <2 x float> @f2rsqrt(<2 x float> %a) #0 {
%1 = tail call fast <2 x float> @llvm.sqrt.v2f32(<2 x float> %a) #2
%2 = fdiv fast <2 x float> <float 1.000000e+00, float 1.000000e+00>, %1
ret <2 x float> %2
; FAULT-LABEL: f2rsqrt:
; FAULT-NEXT: BB#0
; FAULT-NEXT: fsqrt
; CHECK-LABEL: f2rsqrt:
; CHECK-NEXT: BB#0
; CHECK-NEXT: fmov
; CHECK-NEXT: frsqrte
}
define <4 x float> @f4rsqrt(<4 x float> %a) #0 {
%1 = tail call fast <4 x float> @llvm.sqrt.v4f32(<4 x float> %a) #2
%2 = fdiv fast <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, %1
ret <4 x float> %2
; FAULT-LABEL: f4rsqrt:
; FAULT-NEXT: BB#0
; FAULT-NEXT: fsqrt
; CHECK-LABEL: f4rsqrt:
; CHECK-NEXT: BB#0
; CHECK-NEXT: fmov
; CHECK-NEXT: 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
ret double %2
; FAULT-LABEL: drsqrt:
; FAULT-NEXT: BB#0
; FAULT-NEXT: fsqrt
; CHECK-LABEL: drsqrt:
; CHECK-NEXT: BB#0
; CHECK-NEXT: fmov
; CHECK-NEXT: frsqrte
}
define <2 x double> @d2rsqrt(<2 x double> %a) #0 {
%1 = tail call fast <2 x double> @llvm.sqrt.v2f64(<2 x double> %a) #2
%2 = fdiv fast <2 x double> <double 1.000000e+00, double 1.000000e+00>, %1
ret <2 x double> %2
; FAULT-LABEL: d2rsqrt:
; FAULT-NEXT: BB#0
; FAULT-NEXT: fsqrt
; CHECK-LABEL: d2rsqrt:
; CHECK-NEXT: BB#0
; CHECK-NEXT: fmov
; CHECK-NEXT: frsqrte
}
attributes #0 = { nounwind "unsafe-fp-math"="true" }
|