blob: d549c7e78421eb8db1d4ccd4b1140de2623e81bb [file] [log] [blame]
Tim Northoverbd668872014-04-15 14:00:29 +00001; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
Tim Northovere0e3aef2013-01-31 12:12:40 +00002
3define i32 @test_floattoi32(float %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +00004; CHECK-LABEL: test_floattoi32:
Tim Northovere0e3aef2013-01-31 12:12:40 +00005
6 %signed = fptosi float %in to i32
7 %unsigned = fptoui float %in to i32
Tim Northover1fdb0762013-10-09 07:53:57 +00008; CHECK-DAG: fcvtzu [[UNSIG:w[0-9]+]], {{s[0-9]+}}
9; CHECK-DAG: fcvtzs [[SIG:w[0-9]+]], {{s[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000010
11 %res = sub i32 %signed, %unsigned
12; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
13
14 ret i32 %res
15; CHECK: ret
16}
17
18define i32 @test_doubletoi32(double %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000019; CHECK-LABEL: test_doubletoi32:
Tim Northovere0e3aef2013-01-31 12:12:40 +000020
21 %signed = fptosi double %in to i32
22 %unsigned = fptoui double %in to i32
Tim Northover1fdb0762013-10-09 07:53:57 +000023; CHECK-DAG: fcvtzu [[UNSIG:w[0-9]+]], {{d[0-9]+}}
24; CHECK-DAG: fcvtzs [[SIG:w[0-9]+]], {{d[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000025
26 %res = sub i32 %signed, %unsigned
27; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
28
29 ret i32 %res
30; CHECK: ret
31}
32
33define i64 @test_floattoi64(float %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000034; CHECK-LABEL: test_floattoi64:
Tim Northovere0e3aef2013-01-31 12:12:40 +000035
36 %signed = fptosi float %in to i64
37 %unsigned = fptoui float %in to i64
Tim Northover1fdb0762013-10-09 07:53:57 +000038; CHECK-DAG: fcvtzu [[UNSIG:x[0-9]+]], {{s[0-9]+}}
39; CHECK-DAG: fcvtzs [[SIG:x[0-9]+]], {{s[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000040
41 %res = sub i64 %signed, %unsigned
42; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
43
44 ret i64 %res
45; CHECK: ret
46}
47
48define i64 @test_doubletoi64(double %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000049; CHECK-LABEL: test_doubletoi64:
Tim Northovere0e3aef2013-01-31 12:12:40 +000050
51 %signed = fptosi double %in to i64
52 %unsigned = fptoui double %in to i64
Tim Northover1fdb0762013-10-09 07:53:57 +000053; CHECK-DAG: fcvtzu [[UNSIG:x[0-9]+]], {{d[0-9]+}}
54; CHECK-DAG: fcvtzs [[SIG:x[0-9]+]], {{d[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000055
56 %res = sub i64 %signed, %unsigned
57; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
58
59 ret i64 %res
60; CHECK: ret
61}
62
63define float @test_i32tofloat(i32 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000064; CHECK-LABEL: test_i32tofloat:
Tim Northovere0e3aef2013-01-31 12:12:40 +000065
66 %signed = sitofp i32 %in to float
67 %unsigned = uitofp i32 %in to float
Tim Northover1fdb0762013-10-09 07:53:57 +000068; CHECK-DAG: ucvtf [[UNSIG:s[0-9]+]], {{w[0-9]+}}
69; CHECK-DAG: scvtf [[SIG:s[0-9]+]], {{w[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000070
71 %res = fsub float %signed, %unsigned
Nico Rieck76471782014-02-16 07:31:05 +000072; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
Tim Northovere0e3aef2013-01-31 12:12:40 +000073 ret float %res
74; CHECK: ret
75}
76
77define double @test_i32todouble(i32 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000078; CHECK-LABEL: test_i32todouble:
Tim Northovere0e3aef2013-01-31 12:12:40 +000079
80 %signed = sitofp i32 %in to double
81 %unsigned = uitofp i32 %in to double
Tim Northover1fdb0762013-10-09 07:53:57 +000082; CHECK-DAG: ucvtf [[UNSIG:d[0-9]+]], {{w[0-9]+}}
83; CHECK-DAG: scvtf [[SIG:d[0-9]+]], {{w[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000084
85 %res = fsub double %signed, %unsigned
86; CHECK: fsub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
87 ret double %res
88; CHECK: ret
89}
90
91define float @test_i64tofloat(i64 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000092; CHECK-LABEL: test_i64tofloat:
Tim Northovere0e3aef2013-01-31 12:12:40 +000093
94 %signed = sitofp i64 %in to float
95 %unsigned = uitofp i64 %in to float
Tim Northover1fdb0762013-10-09 07:53:57 +000096; CHECK-DAG: ucvtf [[UNSIG:s[0-9]+]], {{x[0-9]+}}
97; CHECK-DAG: scvtf [[SIG:s[0-9]+]], {{x[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000098
99 %res = fsub float %signed, %unsigned
100; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
101 ret float %res
102; CHECK: ret
103}
104
105define double @test_i64todouble(i64 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +0000106; CHECK-LABEL: test_i64todouble:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000107
108 %signed = sitofp i64 %in to double
109 %unsigned = uitofp i64 %in to double
Tim Northover1fdb0762013-10-09 07:53:57 +0000110; CHECK-DAG: ucvtf [[UNSIG:d[0-9]+]], {{x[0-9]+}}
111; CHECK-DAG: scvtf [[SIG:d[0-9]+]], {{x[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +0000112
113 %res = fsub double %signed, %unsigned
114; CHECK: sub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
115 ret double %res
116; CHECK: ret
117}
118
119define i32 @test_bitcastfloattoi32(float %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +0000120; CHECK-LABEL: test_bitcastfloattoi32:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000121
122 %res = bitcast float %in to i32
123; CHECK: fmov {{w[0-9]+}}, {{s[0-9]+}}
124 ret i32 %res
125}
126
127define i64 @test_bitcastdoubletoi64(double %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +0000128; CHECK-LABEL: test_bitcastdoubletoi64:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000129
130 %res = bitcast double %in to i64
131; CHECK: fmov {{x[0-9]+}}, {{d[0-9]+}}
132 ret i64 %res
133}
134
135define float @test_bitcasti32tofloat(i32 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +0000136; CHECK-LABEL: test_bitcasti32tofloat:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000137
138 %res = bitcast i32 %in to float
139; CHECK: fmov {{s[0-9]+}}, {{w[0-9]+}}
140 ret float %res
141
142}
143
144define double @test_bitcasti64todouble(i64 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +0000145; CHECK-LABEL: test_bitcasti64todouble:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000146
147 %res = bitcast i64 %in to double
148; CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}
149 ret double %res
150
151}