1 ; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
3 define i32 @test_floattoi32(float %in) {
4 ; CHECK-LABEL: test_floattoi32:
6 %signed = fptosi float %in to i32
7 %unsigned = fptoui float %in to i32
8 ; CHECK-DAG: fcvtzu [[UNSIG:w[0-9]+]], {{s[0-9]+}}
9 ; CHECK-DAG: fcvtzs [[SIG:w[0-9]+]], {{s[0-9]+}}
11 %res = sub i32 %signed, %unsigned
12 ; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
18 define i32 @test_doubletoi32(double %in) {
19 ; CHECK-LABEL: test_doubletoi32:
21 %signed = fptosi double %in to i32
22 %unsigned = fptoui double %in to i32
23 ; CHECK-DAG: fcvtzu [[UNSIG:w[0-9]+]], {{d[0-9]+}}
24 ; CHECK-DAG: fcvtzs [[SIG:w[0-9]+]], {{d[0-9]+}}
26 %res = sub i32 %signed, %unsigned
27 ; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
33 define i64 @test_floattoi64(float %in) {
34 ; CHECK-LABEL: test_floattoi64:
36 %signed = fptosi float %in to i64
37 %unsigned = fptoui float %in to i64
38 ; CHECK-DAG: fcvtzu [[UNSIG:x[0-9]+]], {{s[0-9]+}}
39 ; CHECK-DAG: fcvtzs [[SIG:x[0-9]+]], {{s[0-9]+}}
41 %res = sub i64 %signed, %unsigned
42 ; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
48 define i64 @test_doubletoi64(double %in) {
49 ; CHECK-LABEL: test_doubletoi64:
51 %signed = fptosi double %in to i64
52 %unsigned = fptoui double %in to i64
53 ; CHECK-DAG: fcvtzu [[UNSIG:x[0-9]+]], {{d[0-9]+}}
54 ; CHECK-DAG: fcvtzs [[SIG:x[0-9]+]], {{d[0-9]+}}
56 %res = sub i64 %signed, %unsigned
57 ; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
63 define float @test_i32tofloat(i32 %in) {
64 ; CHECK-LABEL: test_i32tofloat:
66 %signed = sitofp i32 %in to float
67 %unsigned = uitofp i32 %in to float
68 ; CHECK-DAG: ucvtf [[UNSIG:s[0-9]+]], {{w[0-9]+}}
69 ; CHECK-DAG: scvtf [[SIG:s[0-9]+]], {{w[0-9]+}}
71 %res = fsub float %signed, %unsigned
72 ; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
77 define double @test_i32todouble(i32 %in) {
78 ; CHECK-LABEL: test_i32todouble:
80 %signed = sitofp i32 %in to double
81 %unsigned = uitofp i32 %in to double
82 ; CHECK-DAG: ucvtf [[UNSIG:d[0-9]+]], {{w[0-9]+}}
83 ; CHECK-DAG: scvtf [[SIG:d[0-9]+]], {{w[0-9]+}}
85 %res = fsub double %signed, %unsigned
86 ; CHECK: fsub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
91 define float @test_i64tofloat(i64 %in) {
92 ; CHECK-LABEL: test_i64tofloat:
94 %signed = sitofp i64 %in to float
95 %unsigned = uitofp i64 %in to float
96 ; CHECK-DAG: ucvtf [[UNSIG:s[0-9]+]], {{x[0-9]+}}
97 ; CHECK-DAG: scvtf [[SIG:s[0-9]+]], {{x[0-9]+}}
99 %res = fsub float %signed, %unsigned
100 ; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
105 define double @test_i64todouble(i64 %in) {
106 ; CHECK-LABEL: test_i64todouble:
108 %signed = sitofp i64 %in to double
109 %unsigned = uitofp i64 %in to double
110 ; CHECK-DAG: ucvtf [[UNSIG:d[0-9]+]], {{x[0-9]+}}
111 ; CHECK-DAG: scvtf [[SIG:d[0-9]+]], {{x[0-9]+}}
113 %res = fsub double %signed, %unsigned
114 ; CHECK: sub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
119 define i32 @test_bitcastfloattoi32(float %in) {
120 ; CHECK-LABEL: test_bitcastfloattoi32:
122 %res = bitcast float %in to i32
123 ; CHECK: fmov {{w[0-9]+}}, {{s[0-9]+}}
127 define i64 @test_bitcastdoubletoi64(double %in) {
128 ; CHECK-LABEL: test_bitcastdoubletoi64:
130 %res = bitcast double %in to i64
131 ; CHECK: fmov {{x[0-9]+}}, {{d[0-9]+}}
135 define float @test_bitcasti32tofloat(i32 %in) {
136 ; CHECK-LABEL: test_bitcasti32tofloat:
138 %res = bitcast i32 %in to float
139 ; CHECK: fmov {{s[0-9]+}}, {{w[0-9]+}}
144 define double @test_bitcasti64todouble(i64 %in) {
145 ; CHECK-LABEL: test_bitcasti64todouble:
147 %res = bitcast i64 %in to double
148 ; CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}
153 define double @bitcast_fabs(double %x) {
154 ; CHECK-LABEL: bitcast_fabs:
156 ; CHECK-NEXT: fabs d0, d0
159 %bc1 = bitcast double %x to i64
160 %and = and i64 %bc1, 9223372036854775807
161 %bc2 = bitcast i64 %and to double
165 define float @bitcast_fneg(float %x) {
166 ; CHECK-LABEL: bitcast_fneg:
168 ; CHECK-NEXT: fneg s0, s0
171 %bc1 = bitcast float %x to i32
172 %xor = xor i32 %bc1, 2147483648
173 %bc2 = bitcast i32 %xor to float