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
4 define i32 @test_floattoi32(float %in) {
5 ; CHECK-LABEL: test_floattoi32:
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]+}}
12 %res = sub i32 %signed, %unsigned
13 ; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
19 define i32 @test_doubletoi32(double %in) {
20 ; CHECK-LABEL: test_doubletoi32:
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]+}}
27 %res = sub i32 %signed, %unsigned
28 ; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
34 define i64 @test_floattoi64(float %in) {
35 ; CHECK-LABEL: test_floattoi64:
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]+}}
42 %res = sub i64 %signed, %unsigned
43 ; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
49 define i64 @test_doubletoi64(double %in) {
50 ; CHECK-LABEL: test_doubletoi64:
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]+}}
57 %res = sub i64 %signed, %unsigned
58 ; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
64 define float @test_i32tofloat(i32 %in) {
65 ; CHECK-LABEL: test_i32tofloat:
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]+}}
72 %res = fsub float %signed, %unsigned
73 ; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
78 define double @test_i32todouble(i32 %in) {
79 ; CHECK-LABEL: test_i32todouble:
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]+}}
86 %res = fsub double %signed, %unsigned
87 ; CHECK: fsub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
92 define float @test_i64tofloat(i64 %in) {
93 ; CHECK-LABEL: test_i64tofloat:
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]+}}
100 %res = fsub float %signed, %unsigned
101 ; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
106 define double @test_i64todouble(i64 %in) {
107 ; CHECK-LABEL: test_i64todouble:
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]+}}
114 %res = fsub double %signed, %unsigned
115 ; CHECK: sub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
120 define i32 @test_bitcastfloattoi32(float %in) {
121 ; CHECK-LABEL: test_bitcastfloattoi32:
123 %res = bitcast float %in to i32
124 ; CHECK: fmov {{w[0-9]+}}, {{s[0-9]+}}
128 define i64 @test_bitcastdoubletoi64(double %in) {
129 ; CHECK-LABEL: test_bitcastdoubletoi64:
131 %res = bitcast double %in to i64
132 ; CHECK: fmov {{x[0-9]+}}, {{d[0-9]+}}
136 define float @test_bitcasti32tofloat(i32 %in) {
137 ; CHECK-LABEL: test_bitcasti32tofloat:
139 %res = bitcast i32 %in to float
140 ; CHECK: fmov {{s[0-9]+}}, {{w[0-9]+}}
145 define double @test_bitcasti64todouble(i64 %in) {
146 ; CHECK-LABEL: test_bitcasti64todouble:
148 %res = bitcast i64 %in to double
149 ; CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}