blob: a85b02538ef5ef95cbd83ebde855c543ed2fad02 [file] [log] [blame]
Tim Northovere3d42362013-02-01 11:40:47 +00001; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
Tim Northoverbd668872014-04-15 14:00:29 +00002; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
Tim Northovere0e3aef2013-01-31 12:12:40 +00003
4define i32 @test_floattoi32(float %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +00005; CHECK-LABEL: test_floattoi32:
Tim Northovere0e3aef2013-01-31 12:12:40 +00006
7 %signed = fptosi float %in to i32
8 %unsigned = fptoui float %in to i32
Tim Northover1fdb0762013-10-09 07:53:57 +00009; CHECK-DAG: fcvtzu [[UNSIG:w[0-9]+]], {{s[0-9]+}}
10; CHECK-DAG: fcvtzs [[SIG:w[0-9]+]], {{s[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000011
12 %res = sub i32 %signed, %unsigned
13; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
14
15 ret i32 %res
16; CHECK: ret
17}
18
19define i32 @test_doubletoi32(double %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000020; CHECK-LABEL: test_doubletoi32:
Tim Northovere0e3aef2013-01-31 12:12:40 +000021
22 %signed = fptosi double %in to i32
23 %unsigned = fptoui double %in to i32
Tim Northover1fdb0762013-10-09 07:53:57 +000024; CHECK-DAG: fcvtzu [[UNSIG:w[0-9]+]], {{d[0-9]+}}
25; CHECK-DAG: fcvtzs [[SIG:w[0-9]+]], {{d[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000026
27 %res = sub i32 %signed, %unsigned
28; CHECK: sub {{w[0-9]+}}, [[SIG]], [[UNSIG]]
29
30 ret i32 %res
31; CHECK: ret
32}
33
34define i64 @test_floattoi64(float %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000035; CHECK-LABEL: test_floattoi64:
Tim Northovere0e3aef2013-01-31 12:12:40 +000036
37 %signed = fptosi float %in to i64
38 %unsigned = fptoui float %in to i64
Tim Northover1fdb0762013-10-09 07:53:57 +000039; CHECK-DAG: fcvtzu [[UNSIG:x[0-9]+]], {{s[0-9]+}}
40; CHECK-DAG: fcvtzs [[SIG:x[0-9]+]], {{s[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000041
42 %res = sub i64 %signed, %unsigned
43; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
44
45 ret i64 %res
46; CHECK: ret
47}
48
49define i64 @test_doubletoi64(double %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000050; CHECK-LABEL: test_doubletoi64:
Tim Northovere0e3aef2013-01-31 12:12:40 +000051
52 %signed = fptosi double %in to i64
53 %unsigned = fptoui double %in to i64
Tim Northover1fdb0762013-10-09 07:53:57 +000054; CHECK-DAG: fcvtzu [[UNSIG:x[0-9]+]], {{d[0-9]+}}
55; CHECK-DAG: fcvtzs [[SIG:x[0-9]+]], {{d[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000056
57 %res = sub i64 %signed, %unsigned
58; CHECK: sub {{x[0-9]+}}, [[SIG]], [[UNSIG]]
59
60 ret i64 %res
61; CHECK: ret
62}
63
64define float @test_i32tofloat(i32 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000065; CHECK-LABEL: test_i32tofloat:
Tim Northovere0e3aef2013-01-31 12:12:40 +000066
67 %signed = sitofp i32 %in to float
68 %unsigned = uitofp i32 %in to float
Tim Northover1fdb0762013-10-09 07:53:57 +000069; CHECK-DAG: ucvtf [[UNSIG:s[0-9]+]], {{w[0-9]+}}
70; CHECK-DAG: scvtf [[SIG:s[0-9]+]], {{w[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000071
72 %res = fsub float %signed, %unsigned
Nico Rieck76471782014-02-16 07:31:05 +000073; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
Tim Northovere0e3aef2013-01-31 12:12:40 +000074 ret float %res
75; CHECK: ret
76}
77
78define double @test_i32todouble(i32 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000079; CHECK-LABEL: test_i32todouble:
Tim Northovere0e3aef2013-01-31 12:12:40 +000080
81 %signed = sitofp i32 %in to double
82 %unsigned = uitofp i32 %in to double
Tim Northover1fdb0762013-10-09 07:53:57 +000083; CHECK-DAG: ucvtf [[UNSIG:d[0-9]+]], {{w[0-9]+}}
84; CHECK-DAG: scvtf [[SIG:d[0-9]+]], {{w[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000085
86 %res = fsub double %signed, %unsigned
87; CHECK: fsub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
88 ret double %res
89; CHECK: ret
90}
91
92define float @test_i64tofloat(i64 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +000093; CHECK-LABEL: test_i64tofloat:
Tim Northovere0e3aef2013-01-31 12:12:40 +000094
95 %signed = sitofp i64 %in to float
96 %unsigned = uitofp i64 %in to float
Tim Northover1fdb0762013-10-09 07:53:57 +000097; CHECK-DAG: ucvtf [[UNSIG:s[0-9]+]], {{x[0-9]+}}
98; CHECK-DAG: scvtf [[SIG:s[0-9]+]], {{x[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +000099
100 %res = fsub float %signed, %unsigned
101; CHECK: fsub {{s[0-9]+}}, [[SIG]], [[UNSIG]]
102 ret float %res
103; CHECK: ret
104}
105
106define double @test_i64todouble(i64 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +0000107; CHECK-LABEL: test_i64todouble:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000108
109 %signed = sitofp i64 %in to double
110 %unsigned = uitofp i64 %in to double
Tim Northover1fdb0762013-10-09 07:53:57 +0000111; CHECK-DAG: ucvtf [[UNSIG:d[0-9]+]], {{x[0-9]+}}
112; CHECK-DAG: scvtf [[SIG:d[0-9]+]], {{x[0-9]+}}
Tim Northovere0e3aef2013-01-31 12:12:40 +0000113
114 %res = fsub double %signed, %unsigned
115; CHECK: sub {{d[0-9]+}}, [[SIG]], [[UNSIG]]
116 ret double %res
117; CHECK: ret
118}
119
120define i32 @test_bitcastfloattoi32(float %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +0000121; CHECK-LABEL: test_bitcastfloattoi32:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000122
123 %res = bitcast float %in to i32
124; CHECK: fmov {{w[0-9]+}}, {{s[0-9]+}}
125 ret i32 %res
126}
127
128define i64 @test_bitcastdoubletoi64(double %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +0000129; CHECK-LABEL: test_bitcastdoubletoi64:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000130
131 %res = bitcast double %in to i64
132; CHECK: fmov {{x[0-9]+}}, {{d[0-9]+}}
133 ret i64 %res
134}
135
136define float @test_bitcasti32tofloat(i32 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +0000137; CHECK-LABEL: test_bitcasti32tofloat:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000138
139 %res = bitcast i32 %in to float
140; CHECK: fmov {{s[0-9]+}}, {{w[0-9]+}}
141 ret float %res
142
143}
144
145define double @test_bitcasti64todouble(i64 %in) {
Stephen Linf799e3f2013-07-13 20:38:47 +0000146; CHECK-LABEL: test_bitcasti64todouble:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000147
148 %res = bitcast i64 %in to double
149; CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}
150 ret double %res
151
152}