1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=sparc < %s | FileCheck %s -check-prefix=V8 -check-prefix=V8-BE 2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=sparcel < %s | FileCheck %s -check-prefix=V8 -check-prefix=V8-EL 3*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=sparc -O0 < %s | FileCheck %s -check-prefix=V8-UNOPT 4*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=sparc -mattr=v9 < %s | FileCheck %s -check-prefix=V9 5*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=sparc64-unknown-linux < %s | FileCheck %s -check-prefix=SPARC64 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_neg: 8*9880d681SAndroid Build Coastguard Worker; V8: call get_double 9*9880d681SAndroid Build Coastguard Worker; V8-BE: fnegs %f0, %f0 10*9880d681SAndroid Build Coastguard Worker; V8-EL: fnegs %f1, %f1 11*9880d681SAndroid Build Coastguard Worker 12*9880d681SAndroid Build Coastguard Worker; V8-UNOPT-LABEL: test_neg: 13*9880d681SAndroid Build Coastguard Worker; V8-UNOPT: fnegs 14*9880d681SAndroid Build Coastguard Worker; V8-UNOPT: ! implicit-def 15*9880d681SAndroid Build Coastguard Worker; V8-UNOPT: fmovs {{.+}}, %f0 16*9880d681SAndroid Build Coastguard Worker; V8-UNOPT: fmovs {{.+}}, %f1 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_neg: 19*9880d681SAndroid Build Coastguard Worker; V9: fnegd %f0, %f0 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_neg: 22*9880d681SAndroid Build Coastguard Worker; SPARC64: fnegd %f0, %f0 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Workerdefine double @test_neg() { 25*9880d681SAndroid Build Coastguard Workerentry: 26*9880d681SAndroid Build Coastguard Worker %0 = tail call double @get_double() 27*9880d681SAndroid Build Coastguard Worker %1 = fsub double -0.000000e+00, %0 28*9880d681SAndroid Build Coastguard Worker ret double %1 29*9880d681SAndroid Build Coastguard Worker} 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_abs: 32*9880d681SAndroid Build Coastguard Worker; V8-BE: fabss %f0, %f0 33*9880d681SAndroid Build Coastguard Worker; V8-EL: fabss %f1, %f1 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker; V8-UNOPT-LABEL: test_abs: 36*9880d681SAndroid Build Coastguard Worker; V8-UNOPT: fabss 37*9880d681SAndroid Build Coastguard Worker; V8-UNOPT: ! implicit-def 38*9880d681SAndroid Build Coastguard Worker; V8-UNOPT: fmovs {{.+}}, %f0 39*9880d681SAndroid Build Coastguard Worker; V8-UNOPT: fmovs {{.+}}, %f1 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_abs: 42*9880d681SAndroid Build Coastguard Worker; V9: fabsd %f0, %f0 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_abs: 46*9880d681SAndroid Build Coastguard Worker; SPARC64: fabsd %f0, %f0 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Workerdefine double @test_abs() { 49*9880d681SAndroid Build Coastguard Workerentry: 50*9880d681SAndroid Build Coastguard Worker %0 = tail call double @get_double() 51*9880d681SAndroid Build Coastguard Worker %1 = tail call double @llvm.fabs.f64(double %0) 52*9880d681SAndroid Build Coastguard Worker ret double %1 53*9880d681SAndroid Build Coastguard Worker} 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Workerdeclare double @get_double() 56*9880d681SAndroid Build Coastguard Workerdeclare double @llvm.fabs.f64(double) nounwind readonly 57*9880d681SAndroid Build Coastguard Worker 58*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_v9_floatreg: 59*9880d681SAndroid Build Coastguard Worker; V8: fsubd {{.+}}, {{.+}}, [[R:%f(((1|2)?(0|2|4|6|8))|30)]] 60*9880d681SAndroid Build Coastguard Worker; V8: std [[R]], [%{{.+}}] 61*9880d681SAndroid Build Coastguard Worker; V8: ldd [%{{.+}}], %f0 62*9880d681SAndroid Build Coastguard Worker; V8: faddd {{.+}}, {{.+}}, {{.+}} 63*9880d681SAndroid Build Coastguard Worker 64*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_v9_floatreg: 65*9880d681SAndroid Build Coastguard Worker; V9: fsubd {{.+}}, {{.+}}, {{.+}} 66*9880d681SAndroid Build Coastguard Worker; V9: faddd {{.+}}, {{.+}}, %f0 67*9880d681SAndroid Build Coastguard Worker 68*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_v9_floatreg: 69*9880d681SAndroid Build Coastguard Worker; SPARC64: fsubd {{.+}}, {{.+}}, {{.+}} 70*9880d681SAndroid Build Coastguard Worker; SPARC64: faddd {{.+}}, {{.+}}, %f0 71*9880d681SAndroid Build Coastguard Worker 72*9880d681SAndroid Build Coastguard Workerdefine double @test_v9_floatreg() { 73*9880d681SAndroid Build Coastguard Workerentry: 74*9880d681SAndroid Build Coastguard Worker %0 = tail call double @get_double() 75*9880d681SAndroid Build Coastguard Worker %1 = tail call double @get_double() 76*9880d681SAndroid Build Coastguard Worker %2 = fsub double %0, %1 77*9880d681SAndroid Build Coastguard Worker tail call void asm sideeffect "", "~{f0},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f8},~{f9},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f18},~{f19},~{f20},~{f21},~{f22},~{f23},~{f24},~{f25},~{f26},~{f27},~{f28},~{f29},~{f30},~{f31}"() 78*9880d681SAndroid Build Coastguard Worker %3 = fadd double %2, %2 79*9880d681SAndroid Build Coastguard Worker ret double %3 80*9880d681SAndroid Build Coastguard Worker} 81*9880d681SAndroid Build Coastguard Worker 82*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_xtos_stox 83*9880d681SAndroid Build Coastguard Worker; V8: call __floatdisf 84*9880d681SAndroid Build Coastguard Worker; V8: call __fixsfdi 85*9880d681SAndroid Build Coastguard Worker 86*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_xtos_stox 87*9880d681SAndroid Build Coastguard Worker; V9: call __floatdisf 88*9880d681SAndroid Build Coastguard Worker; V9: call __fixsfdi 89*9880d681SAndroid Build Coastguard Worker 90*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_xtos_stox 91*9880d681SAndroid Build Coastguard Worker; SPARC64: fxtos 92*9880d681SAndroid Build Coastguard Worker; SPARC64: fstox 93*9880d681SAndroid Build Coastguard Worker 94*9880d681SAndroid Build Coastguard Workerdefine void @test_xtos_stox(i64 %a, i64* %ptr0, float* %ptr1) { 95*9880d681SAndroid Build Coastguard Workerentry: 96*9880d681SAndroid Build Coastguard Worker %0 = sitofp i64 %a to float 97*9880d681SAndroid Build Coastguard Worker store float %0, float* %ptr1, align 8 98*9880d681SAndroid Build Coastguard Worker %1 = fptosi float %0 to i64 99*9880d681SAndroid Build Coastguard Worker store i64 %1, i64* %ptr0, align 8 100*9880d681SAndroid Build Coastguard Worker ret void 101*9880d681SAndroid Build Coastguard Worker} 102*9880d681SAndroid Build Coastguard Worker 103*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_itos_stoi 104*9880d681SAndroid Build Coastguard Worker; V8: fitos 105*9880d681SAndroid Build Coastguard Worker; V8: fstoi 106*9880d681SAndroid Build Coastguard Worker 107*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_itos_stoi 108*9880d681SAndroid Build Coastguard Worker; V9: fitos 109*9880d681SAndroid Build Coastguard Worker; V9: fstoi 110*9880d681SAndroid Build Coastguard Worker 111*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_itos_stoi 112*9880d681SAndroid Build Coastguard Worker; SPARC64: fitos 113*9880d681SAndroid Build Coastguard Worker; SPARC64: fstoi 114*9880d681SAndroid Build Coastguard Worker 115*9880d681SAndroid Build Coastguard Workerdefine void @test_itos_stoi(i32 %a, i32* %ptr0, float* %ptr1) { 116*9880d681SAndroid Build Coastguard Workerentry: 117*9880d681SAndroid Build Coastguard Worker %0 = sitofp i32 %a to float 118*9880d681SAndroid Build Coastguard Worker store float %0, float* %ptr1, align 8 119*9880d681SAndroid Build Coastguard Worker %1 = fptosi float %0 to i32 120*9880d681SAndroid Build Coastguard Worker store i32 %1, i32* %ptr0, align 8 121*9880d681SAndroid Build Coastguard Worker ret void 122*9880d681SAndroid Build Coastguard Worker} 123*9880d681SAndroid Build Coastguard Worker 124*9880d681SAndroid Build Coastguard Worker 125*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_xtod_dtox 126*9880d681SAndroid Build Coastguard Worker; V8: call __floatdidf 127*9880d681SAndroid Build Coastguard Worker; V8: call __fixdfdi 128*9880d681SAndroid Build Coastguard Worker 129*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_xtod_dtox 130*9880d681SAndroid Build Coastguard Worker; V9: call __floatdidf 131*9880d681SAndroid Build Coastguard Worker; V9: call __fixdfdi 132*9880d681SAndroid Build Coastguard Worker 133*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_xtod_dtox 134*9880d681SAndroid Build Coastguard Worker; SPARC64: fxtod 135*9880d681SAndroid Build Coastguard Worker; SPARC64: fdtox 136*9880d681SAndroid Build Coastguard Worker 137*9880d681SAndroid Build Coastguard Workerdefine void @test_xtod_dtox(i64 %a, i64* %ptr0, double* %ptr1) { 138*9880d681SAndroid Build Coastguard Workerentry: 139*9880d681SAndroid Build Coastguard Worker %0 = sitofp i64 %a to double 140*9880d681SAndroid Build Coastguard Worker store double %0, double* %ptr1, align 8 141*9880d681SAndroid Build Coastguard Worker %1 = fptosi double %0 to i64 142*9880d681SAndroid Build Coastguard Worker store i64 %1, i64* %ptr0, align 8 143*9880d681SAndroid Build Coastguard Worker ret void 144*9880d681SAndroid Build Coastguard Worker} 145*9880d681SAndroid Build Coastguard Worker 146*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_itod_dtoi 147*9880d681SAndroid Build Coastguard Worker; V8: fitod 148*9880d681SAndroid Build Coastguard Worker; V8: fdtoi 149*9880d681SAndroid Build Coastguard Worker 150*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_itod_dtoi 151*9880d681SAndroid Build Coastguard Worker; V9: fitod 152*9880d681SAndroid Build Coastguard Worker; V9: fdtoi 153*9880d681SAndroid Build Coastguard Worker 154*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_itod_dtoi 155*9880d681SAndroid Build Coastguard Worker; SPARC64: fitod 156*9880d681SAndroid Build Coastguard Worker; SPARC64: fdtoi 157*9880d681SAndroid Build Coastguard Worker 158*9880d681SAndroid Build Coastguard Workerdefine void @test_itod_dtoi(i32 %a, double %b, i32* %ptr0, double* %ptr1) { 159*9880d681SAndroid Build Coastguard Workerentry: 160*9880d681SAndroid Build Coastguard Worker %0 = sitofp i32 %a to double 161*9880d681SAndroid Build Coastguard Worker store double %0, double* %ptr1, align 8 162*9880d681SAndroid Build Coastguard Worker %1 = fptosi double %b to i32 163*9880d681SAndroid Build Coastguard Worker store i32 %1, i32* %ptr0, align 8 164*9880d681SAndroid Build Coastguard Worker ret void 165*9880d681SAndroid Build Coastguard Worker} 166*9880d681SAndroid Build Coastguard Worker 167*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_uxtos_stoux 168*9880d681SAndroid Build Coastguard Worker; V8: call __floatundisf 169*9880d681SAndroid Build Coastguard Worker; V8: call __fixunssfdi 170*9880d681SAndroid Build Coastguard Worker 171*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_uxtos_stoux 172*9880d681SAndroid Build Coastguard Worker; V9: call __floatundisf 173*9880d681SAndroid Build Coastguard Worker; V9: call __fixunssfdi 174*9880d681SAndroid Build Coastguard Worker 175*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_uxtos_stoux 176*9880d681SAndroid Build Coastguard Worker; SPARC64-NOT: call __floatundisf 177*9880d681SAndroid Build Coastguard Worker; SPARC64-NOT: call __fixunssfdi 178*9880d681SAndroid Build Coastguard Worker 179*9880d681SAndroid Build Coastguard Workerdefine void @test_uxtos_stoux(i64 %a, i64* %ptr0, float* %ptr1) { 180*9880d681SAndroid Build Coastguard Workerentry: 181*9880d681SAndroid Build Coastguard Worker %0 = uitofp i64 %a to float 182*9880d681SAndroid Build Coastguard Worker store float %0, float* %ptr1, align 8 183*9880d681SAndroid Build Coastguard Worker %1 = fptoui float %0 to i64 184*9880d681SAndroid Build Coastguard Worker store i64 %1, i64* %ptr0, align 8 185*9880d681SAndroid Build Coastguard Worker ret void 186*9880d681SAndroid Build Coastguard Worker} 187*9880d681SAndroid Build Coastguard Worker 188*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_utos_stou 189*9880d681SAndroid Build Coastguard Worker; V8: fdtos 190*9880d681SAndroid Build Coastguard Worker; V8: fstoi 191*9880d681SAndroid Build Coastguard Worker 192*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_utos_stou 193*9880d681SAndroid Build Coastguard Worker; V9: fdtos 194*9880d681SAndroid Build Coastguard Worker; V9: fstoi 195*9880d681SAndroid Build Coastguard Worker 196*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_utos_stou 197*9880d681SAndroid Build Coastguard Worker; SPARC64: fdtos 198*9880d681SAndroid Build Coastguard Worker; SPARC64: fstoi 199*9880d681SAndroid Build Coastguard Worker 200*9880d681SAndroid Build Coastguard Workerdefine void @test_utos_stou(i32 %a, i32* %ptr0, float* %ptr1) { 201*9880d681SAndroid Build Coastguard Workerentry: 202*9880d681SAndroid Build Coastguard Worker %0 = uitofp i32 %a to float 203*9880d681SAndroid Build Coastguard Worker store float %0, float* %ptr1, align 8 204*9880d681SAndroid Build Coastguard Worker %1 = fptoui float %0 to i32 205*9880d681SAndroid Build Coastguard Worker store i32 %1, i32* %ptr0, align 8 206*9880d681SAndroid Build Coastguard Worker ret void 207*9880d681SAndroid Build Coastguard Worker} 208*9880d681SAndroid Build Coastguard Worker 209*9880d681SAndroid Build Coastguard Worker 210*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_uxtod_dtoux 211*9880d681SAndroid Build Coastguard Worker; V8: call __floatundidf 212*9880d681SAndroid Build Coastguard Worker; V8: call __fixunsdfdi 213*9880d681SAndroid Build Coastguard Worker 214*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_uxtod_dtoux 215*9880d681SAndroid Build Coastguard Worker; V9: call __floatundidf 216*9880d681SAndroid Build Coastguard Worker; V9: call __fixunsdfdi 217*9880d681SAndroid Build Coastguard Worker 218*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_uxtod_dtoux 219*9880d681SAndroid Build Coastguard Worker; SPARC64-NOT: call __floatundidf 220*9880d681SAndroid Build Coastguard Worker; SPARC64-NOT: call __floatunsdfdi 221*9880d681SAndroid Build Coastguard Worker 222*9880d681SAndroid Build Coastguard Workerdefine void @test_uxtod_dtoux(i64 %a, i64* %ptr0, double* %ptr1) { 223*9880d681SAndroid Build Coastguard Workerentry: 224*9880d681SAndroid Build Coastguard Worker %0 = uitofp i64 %a to double 225*9880d681SAndroid Build Coastguard Worker store double %0, double* %ptr1, align 8 226*9880d681SAndroid Build Coastguard Worker %1 = fptoui double %0 to i64 227*9880d681SAndroid Build Coastguard Worker store i64 %1, i64* %ptr0, align 8 228*9880d681SAndroid Build Coastguard Worker ret void 229*9880d681SAndroid Build Coastguard Worker} 230*9880d681SAndroid Build Coastguard Worker 231*9880d681SAndroid Build Coastguard Worker; V8-LABEL: test_utod_dtou 232*9880d681SAndroid Build Coastguard Worker; V8-NOT: fitod 233*9880d681SAndroid Build Coastguard Worker; V8: fdtoi 234*9880d681SAndroid Build Coastguard Worker 235*9880d681SAndroid Build Coastguard Worker; V9-LABEL: test_utod_dtou 236*9880d681SAndroid Build Coastguard Worker; V9-NOT: fitod 237*9880d681SAndroid Build Coastguard Worker; V9: fdtoi 238*9880d681SAndroid Build Coastguard Worker 239*9880d681SAndroid Build Coastguard Worker; SPARC64-LABEL: test_utod_dtou 240*9880d681SAndroid Build Coastguard Worker; SPARC64-NOT: fitod 241*9880d681SAndroid Build Coastguard Worker; SPARC64: fdtoi 242*9880d681SAndroid Build Coastguard Worker 243*9880d681SAndroid Build Coastguard Workerdefine void @test_utod_dtou(i32 %a, double %b, i32* %ptr0, double* %ptr1) { 244*9880d681SAndroid Build Coastguard Workerentry: 245*9880d681SAndroid Build Coastguard Worker %0 = uitofp i32 %a to double 246*9880d681SAndroid Build Coastguard Worker store double %0, double* %ptr1, align 8 247*9880d681SAndroid Build Coastguard Worker %1 = fptoui double %b to i32 248*9880d681SAndroid Build Coastguard Worker store i32 %1, i32* %ptr0, align 8 249*9880d681SAndroid Build Coastguard Worker ret void 250*9880d681SAndroid Build Coastguard Worker} 251