Ahmed Bougacha | 7daf3b8 | 2014-10-23 22:49:25 +0000 | [diff] [blame] | 1 | ; 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 | |
| 8 | define <1 x double> @test_sitofp(<1 x i1> %in) { |
| 9 | ; CHECK-LABEL: test_sitofp: |
Ahmed Bougacha | 26f63f7 | 2014-10-24 00:03:46 +0000 | [diff] [blame] | 10 | ; CHECK: sbfx [[GPR:w[0-9]+]], w0, #0, #1 |
| 11 | ; CHECK-NEXT: scvtf d0, [[GPR]] |
Ahmed Bougacha | 7daf3b8 | 2014-10-23 22:49:25 +0000 | [diff] [blame] | 12 | ; CHECK-NEXT: ret |
| 13 | entry: |
| 14 | %0 = sitofp <1 x i1> %in to <1 x double> |
| 15 | ret <1 x double> %0 |
| 16 | } |
| 17 | |
| 18 | define <1 x double> @test_uitofp(<1 x i1> %in) { |
| 19 | ; CHECK-LABEL: test_uitofp: |
Ahmed Bougacha | 26f63f7 | 2014-10-24 00:03:46 +0000 | [diff] [blame] | 20 | ; CHECK: and [[GPR:w[0-9]+]], w0, #0x1 |
| 21 | ; CHECK-NEXT: ucvtf d0, [[GPR]] |
Ahmed Bougacha | 7daf3b8 | 2014-10-23 22:49:25 +0000 | [diff] [blame] | 22 | ; CHECK-NEXT: ret |
| 23 | entry: |
| 24 | %0 = uitofp <1 x i1> %in to <1 x double> |
| 25 | ret <1 x double> %0 |
| 26 | } |
| 27 | |
| 28 | define <1 x i64> @test_fptosi(<1 x fp128> %in) { |
| 29 | ; CHECK-LABEL: test_fptosi: |
| 30 | ; CHECK: bl ___fixtfdi |
| 31 | ; CHECK-NEXT: fmov d0, x0 |
| 32 | entry: |
| 33 | %0 = fptosi <1 x fp128> %in to <1 x i64> |
| 34 | ret <1 x i64> %0 |
| 35 | } |
| 36 | |
| 37 | define <1 x i64> @test_fptoui(<1 x fp128> %in) { |
| 38 | ; CHECK-LABEL: test_fptoui: |
| 39 | ; CHECK: bl ___fixunstfdi |
| 40 | ; CHECK-NEXT: fmov d0, x0 |
| 41 | entry: |
| 42 | %0 = fptoui <1 x fp128> %in to <1 x i64> |
| 43 | ret <1 x i64> %0 |
| 44 | } |