|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: llc < %s | FileCheck %s |
| 3 | + |
| 4 | +target triple = "aarch64" |
| 5 | + |
| 6 | +; First some corner cases |
| 7 | +define <4 x float> @f_v4_s0(<4 x i32> %u) { |
| 8 | +; CHECK-LABEL: f_v4_s0: |
| 9 | +; CHECK: // %bb.0: |
| 10 | +; CHECK-NEXT: scvtf v0.4s, v0.4s |
| 11 | +; CHECK-NEXT: ret |
| 12 | + %s = ashr exact <4 x i32> %u, <i32 0, i32 0, i32 0, i32 0> |
| 13 | + %v = sitofp <4 x i32> %s to <4 x float> |
| 14 | + ret <4 x float> %v |
| 15 | +} |
| 16 | + |
| 17 | +define <4 x float> @f_v4_s1(<4 x i32> %u) { |
| 18 | +; CHECK-LABEL: f_v4_s1: |
| 19 | +; CHECK: // %bb.0: |
| 20 | +; CHECK-NEXT: scvtf v0.4s, v0.4s, #1 |
| 21 | +; CHECK-NEXT: ret |
| 22 | + %s = ashr exact <4 x i32> %u, <i32 1, i32 1, i32 1, i32 1> |
| 23 | + %v = sitofp <4 x i32> %s to <4 x float> |
| 24 | + ret <4 x float> %v |
| 25 | +} |
| 26 | + |
| 27 | +define <4 x float> @f_v4_s24_inexact(<4 x i32> %u) { |
| 28 | +; CHECK-LABEL: f_v4_s24_inexact: |
| 29 | +; CHECK: // %bb.0: |
| 30 | +; CHECK-NEXT: sshr v0.4s, v0.4s, #24 |
| 31 | +; CHECK-NEXT: scvtf v0.4s, v0.4s |
| 32 | +; CHECK-NEXT: ret |
| 33 | + %s = ashr <4 x i32> %u, <i32 24, i32 24, i32 24, i32 24> |
| 34 | + %v = sitofp <4 x i32> %s to <4 x float> |
| 35 | + ret <4 x float> %v |
| 36 | +} |
| 37 | + |
| 38 | +define <4 x float> @f_v4_s32(<4 x i32> %u) { |
| 39 | +; CHECK-LABEL: f_v4_s32: |
| 40 | +; CHECK: // %bb.0: |
| 41 | +; CHECK-NEXT: movi v0.2d, #0000000000000000 |
| 42 | +; CHECK-NEXT: ret |
| 43 | + %s = ashr <4 x i32> %u, <i32 32, i32 32, i32 32, i32 32> |
| 44 | + %v = sitofp <4 x i32> %s to <4 x float> |
| 45 | + ret <4 x float> %v |
| 46 | +} |
| 47 | + |
| 48 | +; Common cases for conversion from signed integer to floating point types |
| 49 | +define <2 x float> @f_v2_s24(<2 x i32> %u) { |
| 50 | +; CHECK-LABEL: f_v2_s24: |
| 51 | +; CHECK: // %bb.0: |
| 52 | +; CHECK-NEXT: scvtf v0.2s, v0.2s, #24 |
| 53 | +; CHECK-NEXT: ret |
| 54 | + %s = ashr exact <2 x i32> %u, <i32 24, i32 24> |
| 55 | + %v = sitofp <2 x i32> %s to <2 x float> |
| 56 | + ret <2 x float> %v |
| 57 | +} |
| 58 | + |
| 59 | +define <4 x float> @f_v4_s24(<4 x i32> %u) { |
| 60 | +; CHECK-LABEL: f_v4_s24: |
| 61 | +; CHECK: // %bb.0: |
| 62 | +; CHECK-NEXT: scvtf v0.4s, v0.4s, #24 |
| 63 | +; CHECK-NEXT: ret |
| 64 | + %s = ashr exact <4 x i32> %u, <i32 24, i32 24, i32 24, i32 24> |
| 65 | + %v = sitofp <4 x i32> %s to <4 x float> |
| 66 | + ret <4 x float> %v |
| 67 | +} |
| 68 | + |
| 69 | +; Check legalisation to <2 x f64> does not get in the way |
| 70 | +define <8 x double> @d_v8_s64(<8 x i64> %u) { |
| 71 | +; CHECK-LABEL: d_v8_s64: |
| 72 | +; CHECK: // %bb.0: |
| 73 | +; CHECK-NEXT: scvtf v0.2d, v0.2d, #56 |
| 74 | +; CHECK-NEXT: scvtf v1.2d, v1.2d, #56 |
| 75 | +; CHECK-NEXT: scvtf v2.2d, v2.2d, #56 |
| 76 | +; CHECK-NEXT: scvtf v3.2d, v3.2d, #56 |
| 77 | +; CHECK-NEXT: ret |
| 78 | + %s = ashr exact <8 x i64> %u, <i64 56, i64 56, i64 56, i64 56, i64 56, i64 56, i64 56, i64 56> |
| 79 | + %v = sitofp <8 x i64> %s to <8 x double> |
| 80 | + ret <8 x double> %v |
| 81 | +} |
| 82 | + |
| 83 | +define <4 x half> @h_v4_s8(<4 x i16> %u) #0 { |
| 84 | +; CHECK-LABEL: h_v4_s8: |
| 85 | +; CHECK: // %bb.0: |
| 86 | +; CHECK-NEXT: scvtf v0.4h, v0.4h, #8 |
| 87 | +; CHECK-NEXT: ret |
| 88 | + %s = ashr exact <4 x i16> %u, <i16 8, i16 8, i16 8, i16 8> |
| 89 | + %v = sitofp <4 x i16> %s to <4 x half> |
| 90 | + ret <4 x half> %v |
| 91 | +} |
| 92 | + |
| 93 | +define <8 x half> @h_v8_s8(<8 x i16> %u) #0 { |
| 94 | +; CHECK-LABEL: h_v8_s8: |
| 95 | +; CHECK: // %bb.0: |
| 96 | +; CHECK-NEXT: scvtf v0.8h, v0.8h, #8 |
| 97 | +; CHECK-NEXT: ret |
| 98 | + %s = ashr exact <8 x i16> %u, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8> |
| 99 | + %v = sitofp <8 x i16> %s to <8 x half> |
| 100 | + ret <8 x half> %v |
| 101 | +} |
| 102 | + |
| 103 | +attributes #0 = { "target-features"="+fullfp16"} |
0 commit comments