AArch64/ARM64: enable more AArch64 tests on ARM64.
[oota-llvm.git] / test / CodeGen / AArch64 / fcvt-int.ll
1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
2 ; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
3
4 define i32 @test_floattoi32(float %in) {
5 ; CHECK-LABEL: test_floattoi32:
6
7   %signed = fptosi float %in to i32
8   %unsigned = fptoui float %in to i32
9 ; CHECK-DAG: fcvtzu [[UNSIG:w[0-9]+]], {{s[0-9]+}}
10 ; CHECK-DAG: fcvtzs [[SIG:w[0-9]+]], {{s[0-9]+}}
11
12   %res = sub i32 %signed, %unsigned
13 ; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
14
15   ret i32 %res
16 ; CHECK: ret
17 }
18
19 define i32 @test_doubletoi32(double %in) {
20 ; CHECK-LABEL: test_doubletoi32:
21
22   %signed = fptosi double %in to i32
23   %unsigned = fptoui double %in to i32
24 ; CHECK-DAG: fcvtzu [[UNSIG:w[0-9]+]], {{d[0-9]+}}
25 ; CHECK-DAG: fcvtzs [[SIG:w[0-9]+]], {{d[0-9]+}}
26
27   %res = sub i32 %signed, %unsigned
28 ; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
29
30   ret i32 %res
31 ; CHECK: ret
32 }
33
34 define i64 @test_floattoi64(float %in) {
35 ; CHECK-LABEL: test_floattoi64:
36
37   %signed = fptosi float %in to i64
38   %unsigned = fptoui float %in to i64
39 ; CHECK-DAG: fcvtzu [[UNSIG:x[0-9]+]], {{s[0-9]+}}
40 ; CHECK-DAG: fcvtzs [[SIG:x[0-9]+]], {{s[0-9]+}}
41
42   %res = sub i64 %signed, %unsigned
43 ; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
44
45   ret i64 %res
46 ; CHECK: ret
47 }
48
49 define i64 @test_doubletoi64(double %in) {
50 ; CHECK-LABEL: test_doubletoi64:
51
52   %signed = fptosi double %in to i64
53   %unsigned = fptoui double %in to i64
54 ; CHECK-DAG: fcvtzu [[UNSIG:x[0-9]+]], {{d[0-9]+}}
55 ; CHECK-DAG: fcvtzs [[SIG:x[0-9]+]], {{d[0-9]+}}
56
57   %res = sub i64 %signed, %unsigned
58 ; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
59
60   ret i64 %res
61 ; CHECK: ret
62 }
63
64 define float @test_i32tofloat(i32 %in) {
65 ; CHECK-LABEL: test_i32tofloat:
66
67   %signed = sitofp i32 %in to float
68   %unsigned = uitofp i32 %in to float
69 ; CHECK-DAG: ucvtf [[UNSIG:s[0-9]+]], {{w[0-9]+}}
70 ; CHECK-DAG: scvtf [[SIG:s[0-9]+]], {{w[0-9]+}}
71
72   %res = fsub float %signed, %unsigned
73 ; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
74   ret float %res
75 ; CHECK: ret
76 }
77
78 define double @test_i32todouble(i32 %in) {
79 ; CHECK-LABEL: test_i32todouble:
80
81   %signed = sitofp i32 %in to double
82   %unsigned = uitofp i32 %in to double
83 ; CHECK-DAG: ucvtf [[UNSIG:d[0-9]+]], {{w[0-9]+}}
84 ; CHECK-DAG: scvtf [[SIG:d[0-9]+]], {{w[0-9]+}}
85
86   %res = fsub double %signed, %unsigned
87 ; CHECK: fsub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
88   ret double %res
89 ; CHECK: ret
90 }
91
92 define float @test_i64tofloat(i64 %in) {
93 ; CHECK-LABEL: test_i64tofloat:
94
95   %signed = sitofp i64 %in to float
96   %unsigned = uitofp i64 %in to float
97 ; CHECK-DAG: ucvtf [[UNSIG:s[0-9]+]], {{x[0-9]+}}
98 ; CHECK-DAG: scvtf [[SIG:s[0-9]+]], {{x[0-9]+}}
99
100   %res = fsub float %signed, %unsigned
101 ; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
102   ret float %res
103 ; CHECK: ret
104 }
105
106 define double @test_i64todouble(i64 %in) {
107 ; CHECK-LABEL: test_i64todouble:
108
109   %signed = sitofp i64 %in to double
110   %unsigned = uitofp i64 %in to double
111 ; CHECK-DAG: ucvtf [[UNSIG:d[0-9]+]], {{x[0-9]+}}
112 ; CHECK-DAG: scvtf [[SIG:d[0-9]+]], {{x[0-9]+}}
113
114   %res = fsub double %signed, %unsigned
115 ; CHECK: sub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
116   ret double %res
117 ; CHECK: ret
118 }
119
120 define i32 @test_bitcastfloattoi32(float %in) {
121 ; CHECK-LABEL: test_bitcastfloattoi32:
122
123    %res = bitcast float %in to i32
124 ; CHECK: fmov {{w[0-9]+}}, {{s[0-9]+}}
125    ret i32 %res
126 }
127
128 define i64 @test_bitcastdoubletoi64(double %in) {
129 ; CHECK-LABEL: test_bitcastdoubletoi64:
130
131    %res = bitcast double %in to i64
132 ; CHECK: fmov {{x[0-9]+}}, {{d[0-9]+}}
133    ret i64 %res
134 }
135
136 define float @test_bitcasti32tofloat(i32 %in) {
137 ; CHECK-LABEL: test_bitcasti32tofloat:
138
139    %res = bitcast i32 %in to float
140 ; CHECK: fmov {{s[0-9]+}}, {{w[0-9]+}}
141    ret float %res
142
143 }
144
145 define double @test_bitcasti64todouble(i64 %in) {
146 ; CHECK-LABEL: test_bitcasti64todouble:
147
148    %res = bitcast i64 %in to double
149 ; CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}
150    ret double %res
151
152 }