summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVenkatraman Govindaraju <venkatra@cs.wisc.edu>2013-11-03 12:28:40 +0000
committerVenkatraman Govindaraju <venkatra@cs.wisc.edu>2013-11-03 12:28:40 +0000
commitfcd5e86396e121fef7ad11d41cc8bc0a541631b2 (patch)
tree7e945b698da26698c80688abaf1761a3b096cb6c /test
parent0c7ba3cef2d99bf15175303d5e2523fe898d009d (diff)
downloadllvm-fcd5e86396e121fef7ad11d41cc8bc0a541631b2.tar.gz
llvm-fcd5e86396e121fef7ad11d41cc8bc0a541631b2.tar.bz2
llvm-fcd5e86396e121fef7ad11d41cc8bc0a541631b2.tar.xz
[SparcV9] Handle i64 <-> float conversions in sparcv9 mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193957 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/SPARC/float.ll181
-rw-r--r--test/CodeGen/SPARC/fp128.ll52
2 files changed, 232 insertions, 1 deletions
diff --git a/test/CodeGen/SPARC/float.ll b/test/CodeGen/SPARC/float.ll
index ca9c40dfd6..66367042ca 100644
--- a/test/CodeGen/SPARC/float.ll
+++ b/test/CodeGen/SPARC/float.ll
@@ -1,7 +1,7 @@
; RUN: llc -march=sparc < %s | FileCheck %s -check-prefix=V8
; RUN: llc -march=sparc -O0 < %s | FileCheck %s -check-prefix=V8-UNOPT
; RUN: llc -march=sparc -mattr=v9 < %s | FileCheck %s -check-prefix=V9
-
+; RUN: llc -mtriple=sparc64-unknown-linux < %s | FileCheck %s -check-prefix=SPARC64
; V8-LABEL: test_neg:
; V8: call get_double
@@ -16,6 +16,9 @@
; V9-LABEL: test_neg:
; V9: fnegd %f0, %f0
+; SPARC64-LABEL: test_neg:
+; SPARC64: fnegd %f0, %f0
+
define double @test_neg() {
entry:
%0 = tail call double @get_double()
@@ -35,6 +38,10 @@ entry:
; V9-LABEL: test_abs:
; V9: fabsd %f0, %f0
+
+; SPARC64-LABEL: test_abs:
+; SPARC64: fabsd %f0, %f0
+
define double @test_abs() {
entry:
%0 = tail call double @get_double()
@@ -56,6 +63,10 @@ declare double @llvm.fabs.f64(double) nounwind readonly
; V9: faddd {{.+}}, {{.+}}, [[R:%f((3(2|4|6|8))|((4|5)(0|2|4|6|8))|(60|62))]]
; V9: fmovd [[R]], %f0
+; SPARC64-LABEL: test_v9_floatreg:
+; SPARC64: fsubd {{.+}}, {{.+}}, {{.+}}
+; SPARC64: faddd {{.+}}, {{.+}}, [[R:%f((3(2|4|6|8))|((4|5)(0|2|4|6|8))|(60|62))]]
+; SPARC64: fmovd [[R]], %f0
define double @test_v9_floatreg() {
entry:
@@ -67,4 +78,172 @@ entry:
ret double %3
}
+; V8-LABEL: test_xtos_stox
+; V8: call __floatdisf
+; V8: call __fixsfdi
+
+; V9-LABEL: test_xtos_stox
+; V9: call __floatdisf
+; V9: call __fixsfdi
+
+; SPARC64-LABEL: test_xtos_stox
+; SPARC64: fxtos
+; SPARC64: fstox
+
+define void @test_xtos_stox(i64 %a, i64* %ptr0, float* %ptr1) {
+entry:
+ %0 = sitofp i64 %a to float
+ store float %0, float* %ptr1, align 8
+ %1 = fptosi float %0 to i64
+ store i64 %1, i64* %ptr0, align 8
+ ret void
+}
+
+; V8-LABEL: test_itos_stoi
+; V8: fitos
+; V8: fstoi
+
+; V9-LABEL: test_itos_stoi
+; V9: fitos
+; V9: fstoi
+
+; SPARC64-LABEL: test_itos_stoi
+; SPARC64: fitos
+; SPARC64: fstoi
+
+define void @test_itos_stoi(i32 %a, i32* %ptr0, float* %ptr1) {
+entry:
+ %0 = sitofp i32 %a to float
+ store float %0, float* %ptr1, align 8
+ %1 = fptosi float %0 to i32
+ store i32 %1, i32* %ptr0, align 8
+ ret void
+}
+
+
+; V8-LABEL: test_xtod_dtox
+; V8: call __floatdidf
+; V8: call __fixdfdi
+
+; V9-LABEL: test_xtod_dtox
+; V9: call __floatdidf
+; V9: call __fixdfdi
+
+; SPARC64-LABEL: test_xtod_dtox
+; SPARC64: fxtod
+; SPARC64: fdtox
+
+define void @test_xtod_dtox(i64 %a, i64* %ptr0, double* %ptr1) {
+entry:
+ %0 = sitofp i64 %a to double
+ store double %0, double* %ptr1, align 8
+ %1 = fptosi double %0 to i64
+ store i64 %1, i64* %ptr0, align 8
+ ret void
+}
+
+; V8-LABEL: test_itod_dtoi
+; V8: fitod
+; V8: fdtoi
+
+; V9-LABEL: test_itod_dtoi
+; V9: fitod
+; V9: fdtoi
+
+; SPARC64-LABEL: test_itod_dtoi
+; SPARC64: fitod
+; SPARC64: fdtoi
+
+define void @test_itod_dtoi(i32 %a, i32* %ptr0, double* %ptr1) {
+entry:
+ %0 = sitofp i32 %a to double
+ store double %0, double* %ptr1, align 8
+ %1 = fptosi double %0 to i32
+ store i32 %1, i32* %ptr0, align 8
+ ret void
+}
+
+; V8-LABEL: test_uxtos_stoux
+; V8: call __floatundisf
+; V8: call __fixunssfdi
+
+; V9-LABEL: test_uxtos_stoux
+; V9: call __floatundisf
+; V9: call __fixunssfdi
+
+; SPARC64-LABEL: test_uxtos_stoux
+; SPARC64-NOT: call __floatundisf
+; SPARC64-NOT: call __fixunssfdi
+
+define void @test_uxtos_stoux(i64 %a, i64* %ptr0, float* %ptr1) {
+entry:
+ %0 = uitofp i64 %a to float
+ store float %0, float* %ptr1, align 8
+ %1 = fptoui float %0 to i64
+ store i64 %1, i64* %ptr0, align 8
+ ret void
+}
+
+; V8-LABEL: test_utos_stou
+; V8: fdtos
+; V8: fstoi
+
+; V9-LABEL: test_utos_stou
+; V9: fdtos
+; V9: fstoi
+
+; SPARC64-LABEL: test_utos_stou
+; SPARC64: fdtos
+; SPARC64: fstoi
+
+define void @test_utos_stou(i32 %a, i32* %ptr0, float* %ptr1) {
+entry:
+ %0 = uitofp i32 %a to float
+ store float %0, float* %ptr1, align 8
+ %1 = fptoui float %0 to i32
+ store i32 %1, i32* %ptr0, align 8
+ ret void
+}
+
+
+; V8-LABEL: test_uxtod_dtoux
+; V8: call __floatundidf
+; V8: call __fixunsdfdi
+
+; V9-LABEL: test_uxtod_dtoux
+; V9: call __floatundidf
+; V9: call __fixunsdfdi
+; SPARC64-LABEL: test_uxtod_dtoux
+; SPARC64-NOT: call __floatundidf
+; SPARC64-NOT: call __floatunsdfdi
+
+define void @test_uxtod_dtoux(i64 %a, i64* %ptr0, double* %ptr1) {
+entry:
+ %0 = uitofp i64 %a to double
+ store double %0, double* %ptr1, align 8
+ %1 = fptoui double %0 to i64
+ store i64 %1, i64* %ptr0, align 8
+ ret void
+}
+
+; V8-LABEL: test_utod_dtou
+; V8-NOT: fitod
+; V8: fdtoi
+
+; V9-LABEL: test_utod_dtou
+; V9-NOT: fitod
+; V9: fdtoi
+
+; SPARC64-LABEL: test_utod_dtou
+; SPARC64-NOT: fitod
+; SPARC64: fdtoi
+
+define void @test_utod_dtou(i32 %a, double %b, i32* %ptr0, double* %ptr1) {
+entry:
+ %0 = uitofp i32 %a to double
+ store double %0, double* %ptr1, align 8
+ %1 = fptoui double %b to i32
+ store i32 %1, i32* %ptr0, align 8
+ ret void
+}
diff --git a/test/CodeGen/SPARC/fp128.ll b/test/CodeGen/SPARC/fp128.ll
index 8049dbe98c..c761361e77 100644
--- a/test/CodeGen/SPARC/fp128.ll
+++ b/test/CodeGen/SPARC/fp128.ll
@@ -180,3 +180,55 @@ entry:
%4 = add i32 %2, %3
ret i32 %4
}
+
+; HARD-LABEL: test_itoq_qtoi
+; HARD: call _Q_lltoq
+; HARD: call _Q_qtoll
+; HARD: fitoq
+; HARD: fqtoi
+
+; SOFT-LABEL: test_itoq_qtoi
+; SOFT: call _Q_lltoq
+; SOFT: call _Q_qtoll
+; SOFT: call _Q_itoq
+; SOFT: call _Q_qtoi
+
+define void @test_itoq_qtoi(i64 %a, i32 %b, i64* %ptr0, fp128* %ptr1) {
+entry:
+ %0 = sitofp i64 %a to fp128
+ store fp128 %0, fp128* %ptr1, align 8
+ %1 = fptosi fp128 %0 to i64
+ store i64 %1, i64* %ptr0, align 8
+ %2 = sitofp i32 %b to fp128
+ store fp128 %2, fp128* %ptr1, align 8
+ %3 = fptosi fp128 %2 to i32
+ %4 = bitcast i64* %ptr0 to i32*
+ store i32 %3, i32* %4, align 8
+ ret void
+}
+
+; HARD-LABEL: test_utoq_qtou
+; HARD-DAG: call _Q_ulltoq
+; HARD-DAG: call _Q_qtoull
+; HARD-DAG: fdtoq
+; HARD-DAG: fqtoi
+
+; SOFT-LABEL: test_utoq_qtou
+; SOFT-DAG: call _Q_ulltoq
+; SOFT-DAG: call _Q_qtoull
+; SOFT-DAG: call _Q_utoq
+; SOFT-DAG: call _Q_qtou
+
+define void @test_utoq_qtou(i64 %a, i32 %b, i64* %ptr0, fp128* %ptr1) {
+entry:
+ %0 = uitofp i64 %a to fp128
+ store fp128 %0, fp128* %ptr1, align 8
+ %1 = fptoui fp128 %0 to i64
+ store i64 %1, i64* %ptr0, align 8
+ %2 = uitofp i32 %b to fp128
+ store fp128 %2, fp128* %ptr1, align 8
+ %3 = fptoui fp128 %2 to i32
+ %4 = bitcast i64* %ptr0 to i32*
+ store i32 %3, i32* %4, align 8
+ ret void
+}