251 lines · plain
1; RUN: llc -mtriple=sparc < %s | FileCheck %s -check-prefix=V8 -check-prefix=V8-BE2; RUN: llc -mtriple=sparcel < %s | FileCheck %s -check-prefix=V8 -check-prefix=V8-EL3; RUN: llc -mtriple=sparc -O0 < %s | FileCheck %s -check-prefix=V8-UNOPT4; RUN: llc -mtriple=sparc -mattr=v9 < %s | FileCheck %s -check-prefix=V95; RUN: llc -mtriple=sparc64-unknown-linux < %s | FileCheck %s -check-prefix=SPARC646 7; V8-LABEL: test_neg:8; V8: call get_double9; V8-BE: fnegs %f0, %f010; V8-EL: fnegs %f1, %f111 12; V8-UNOPT-LABEL: test_neg:13; V8-UNOPT: fnegs14; V8-UNOPT: ! implicit-def15; V8-UNOPT: fmovs {{.+}}, %f016; V8-UNOPT: fmovs {{.+}}, %f117 18; V9-LABEL: test_neg:19; V9: fnegd %f0, %f020 21; SPARC64-LABEL: test_neg:22; SPARC64: fnegd %f0, %f023 24define double @test_neg() {25entry:26 %0 = tail call double @get_double()27 %1 = fsub double -0.000000e+00, %028 ret double %129}30 31; V8-LABEL: test_abs:32; V8-BE: fabss %f0, %f033; V8-EL: fabss %f1, %f134 35; V8-UNOPT-LABEL: test_abs:36; V8-UNOPT: fabss37; V8-UNOPT: ! implicit-def38; V8-UNOPT: fmovs {{.+}}, %f039; V8-UNOPT: fmovs {{.+}}, %f140 41; V9-LABEL: test_abs:42; V9: fabsd %f0, %f043 44 45; SPARC64-LABEL: test_abs:46; SPARC64: fabsd %f0, %f047 48define double @test_abs() {49entry:50 %0 = tail call double @get_double()51 %1 = tail call double @llvm.fabs.f64(double %0)52 ret double %153}54 55declare double @get_double()56declare double @llvm.fabs.f64(double) nounwind readonly57 58; V8-LABEL: test_v9_floatreg:59; V8: fsubd {{.+}}, {{.+}}, [[R:%f(((1|2)?(0|2|4|6|8))|30)]]60; V8: std [[R]], [%{{.+}}]61; V8: ldd [%{{.+}}], %f062; V8: faddd {{.+}}, {{.+}}, {{.+}}63 64; V9-LABEL: test_v9_floatreg:65; V9: fsubd {{.+}}, {{.+}}, {{.+}}66; V9: faddd {{.+}}, {{.+}}, %f067 68; SPARC64-LABEL: test_v9_floatreg:69; SPARC64: fsubd {{.+}}, {{.+}}, {{.+}}70; SPARC64: faddd {{.+}}, {{.+}}, %f071 72define double @test_v9_floatreg() {73entry:74 %0 = tail call double @get_double()75 %1 = tail call double @get_double()76 %2 = fsub double %0, %177 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 %3 = fadd double %2, %279 ret double %380}81 82; V8-LABEL: test_xtos_stox83; V8: call __floatdisf84; V8: call __fixsfdi85 86; V9-LABEL: test_xtos_stox87; V9: call __floatdisf88; V9: call __fixsfdi89 90; SPARC64-LABEL: test_xtos_stox91; SPARC64: fxtos92; SPARC64: fstox93 94define void @test_xtos_stox(i64 %a, ptr %ptr0, ptr %ptr1) {95entry:96 %0 = sitofp i64 %a to float97 store float %0, ptr %ptr1, align 898 %1 = fptosi float %0 to i6499 store i64 %1, ptr %ptr0, align 8100 ret void101}102 103; V8-LABEL: test_itos_stoi104; V8: fitos105; V8: fstoi106 107; V9-LABEL: test_itos_stoi108; V9: fitos109; V9: fstoi110 111; SPARC64-LABEL: test_itos_stoi112; SPARC64: fitos113; SPARC64: fstoi114 115define void @test_itos_stoi(i32 %a, ptr %ptr0, ptr %ptr1) {116entry:117 %0 = sitofp i32 %a to float118 store float %0, ptr %ptr1, align 8119 %1 = fptosi float %0 to i32120 store i32 %1, ptr %ptr0, align 8121 ret void122}123 124 125; V8-LABEL: test_xtod_dtox126; V8: call __floatdidf127; V8: call __fixdfdi128 129; V9-LABEL: test_xtod_dtox130; V9: call __floatdidf131; V9: call __fixdfdi132 133; SPARC64-LABEL: test_xtod_dtox134; SPARC64: fxtod135; SPARC64: fdtox136 137define void @test_xtod_dtox(i64 %a, ptr %ptr0, ptr %ptr1) {138entry:139 %0 = sitofp i64 %a to double140 store double %0, ptr %ptr1, align 8141 %1 = fptosi double %0 to i64142 store i64 %1, ptr %ptr0, align 8143 ret void144}145 146; V8-LABEL: test_itod_dtoi147; V8: fitod148; V8: fdtoi149 150; V9-LABEL: test_itod_dtoi151; V9: fitod152; V9: fdtoi153 154; SPARC64-LABEL: test_itod_dtoi155; SPARC64: fitod156; SPARC64: fdtoi157 158define void @test_itod_dtoi(i32 %a, double %b, ptr %ptr0, ptr %ptr1) {159entry:160 %0 = sitofp i32 %a to double161 store double %0, ptr %ptr1, align 8162 %1 = fptosi double %b to i32163 store i32 %1, ptr %ptr0, align 8164 ret void165}166 167; V8-LABEL: test_uxtos_stoux168; V8: call __floatundisf169; V8: call __fixunssfdi170 171; V9-LABEL: test_uxtos_stoux172; V9: call __floatundisf173; V9: call __fixunssfdi174 175; SPARC64-LABEL: test_uxtos_stoux176; SPARC64-NOT: call __floatundisf177; SPARC64-NOT: call __fixunssfdi178 179define void @test_uxtos_stoux(i64 %a, ptr %ptr0, ptr %ptr1) {180entry:181 %0 = uitofp i64 %a to float182 store float %0, ptr %ptr1, align 8183 %1 = fptoui float %0 to i64184 store i64 %1, ptr %ptr0, align 8185 ret void186}187 188; V8-LABEL: test_utos_stou189; V8: fdtos190; V8: fstoi191 192; V9-LABEL: test_utos_stou193; V9: fdtos194; V9: fstoi195 196; SPARC64-LABEL: test_utos_stou197; SPARC64: fdtos198; SPARC64: fstoi199 200define void @test_utos_stou(i32 %a, ptr %ptr0, ptr %ptr1) {201entry:202 %0 = uitofp i32 %a to float203 store float %0, ptr %ptr1, align 8204 %1 = fptoui float %0 to i32205 store i32 %1, ptr %ptr0, align 8206 ret void207}208 209 210; V8-LABEL: test_uxtod_dtoux211; V8: call __floatundidf212; V8: call __fixunsdfdi213 214; V9-LABEL: test_uxtod_dtoux215; V9: call __floatundidf216; V9: call __fixunsdfdi217 218; SPARC64-LABEL: test_uxtod_dtoux219; SPARC64-NOT: call __floatundidf220; SPARC64-NOT: call __floatunsdfdi221 222define void @test_uxtod_dtoux(i64 %a, ptr %ptr0, ptr %ptr1) {223entry:224 %0 = uitofp i64 %a to double225 store double %0, ptr %ptr1, align 8226 %1 = fptoui double %0 to i64227 store i64 %1, ptr %ptr0, align 8228 ret void229}230 231; V8-LABEL: test_utod_dtou232; V8-NOT: fitod233; V8: fdtoi234 235; V9-LABEL: test_utod_dtou236; V9-NOT: fitod237; V9: fdtoi238 239; SPARC64-LABEL: test_utod_dtou240; SPARC64-NOT: fitod241; SPARC64: fdtoi242 243define void @test_utod_dtou(i32 %a, double %b, ptr %ptr0, ptr %ptr1) {244entry:245 %0 = uitofp i32 %a to double246 store double %0, ptr %ptr1, align 8247 %1 = fptoui double %b to i32248 store i32 %1, ptr %ptr0, align 8249 ret void250}251