blob: 56e0b4a0b1809ee40c4bea457a586befad6b7aaa [file] [log] [blame]
Ahmed Bougacha7daf3b82014-10-23 22:49:25 +00001; RUN: llc < %s -mtriple=arm64-apple-darwin | FileCheck %s
2
3; PR20778
4; Check that the legalizer doesn't crash when scalarizing FP conversion
5; instructions' operands. The operands are all illegal on AArch64,
6; ensuring they are legalized. The results are all legal.
7
8define <1 x double> @test_sitofp(<1 x i1> %in) {
9; CHECK-LABEL: test_sitofp:
Ahmed Bougacha26f63f72014-10-24 00:03:46 +000010; CHECK: sbfx [[GPR:w[0-9]+]], w0, #0, #1
11; CHECK-NEXT: scvtf d0, [[GPR]]
Ahmed Bougacha7daf3b82014-10-23 22:49:25 +000012; CHECK-NEXT: ret
13entry:
14 %0 = sitofp <1 x i1> %in to <1 x double>
15 ret <1 x double> %0
16}
17
18define <1 x double> @test_uitofp(<1 x i1> %in) {
19; CHECK-LABEL: test_uitofp:
Ahmed Bougacha26f63f72014-10-24 00:03:46 +000020; CHECK: and [[GPR:w[0-9]+]], w0, #0x1
21; CHECK-NEXT: ucvtf d0, [[GPR]]
Ahmed Bougacha7daf3b82014-10-23 22:49:25 +000022; CHECK-NEXT: ret
23entry:
24 %0 = uitofp <1 x i1> %in to <1 x double>
25 ret <1 x double> %0
26}
27
28define <1 x i64> @test_fptosi(<1 x fp128> %in) {
29; CHECK-LABEL: test_fptosi:
30; CHECK: bl ___fixtfdi
31; CHECK-NEXT: fmov d0, x0
32entry:
33 %0 = fptosi <1 x fp128> %in to <1 x i64>
34 ret <1 x i64> %0
35}
36
37define <1 x i64> @test_fptoui(<1 x fp128> %in) {
38; CHECK-LABEL: test_fptoui:
39; CHECK: bl ___fixunstfdi
40; CHECK-NEXT: fmov d0, x0
41entry:
42 %0 = fptoui <1 x fp128> %in to <1 x i64>
43 ret <1 x i64> %0
44}