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