Oliver Stannard | 181afc7 | 2019-03-04 09:17:38 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple armv8a--none-eabi -mattr=+fullfp16 | FileCheck %s |
| 2 | |
| 3 | define void @load_zero(half* %in, half* %out) { |
| 4 | entry: |
| 5 | ; CHECK-LABEL: load_zero: |
| 6 | ; CHECK: vldr.16 {{s[0-9]+}}, [r0] |
| 7 | %arrayidx = getelementptr inbounds half, half* %in, i32 0 |
| 8 | %load = load half, half* %arrayidx, align 2 |
| 9 | store half %load, half* %out |
| 10 | ret void |
| 11 | } |
| 12 | |
| 13 | define void @load_255(half* %in, half* %out) { |
| 14 | entry: |
| 15 | ; CHECK-LABEL: load_255: |
| 16 | ; CHECK: vldr.16 {{s[0-9]+}}, [r0, #510] |
| 17 | %arrayidx = getelementptr inbounds half, half* %in, i32 255 |
| 18 | %load = load half, half* %arrayidx, align 2 |
| 19 | store half %load, half* %out |
| 20 | ret void |
| 21 | } |
| 22 | |
| 23 | define void @load_256(half* %in, half* %out) { |
| 24 | entry: |
| 25 | ; CHECK-LABEL: load_256: |
| 26 | ; CHECK: add [[ADDR:r[0-9]+]], r0, #512 |
| 27 | ; CHECK: vldr.16 {{s[0-9]+}}, {{\[}}[[ADDR]]{{\]}} |
| 28 | %arrayidx = getelementptr inbounds half, half* %in, i32 256 |
| 29 | %load = load half, half* %arrayidx, align 2 |
| 30 | store half %load, half* %out |
| 31 | ret void |
| 32 | } |
| 33 | |
| 34 | define void @load_neg_255(half* %in, half* %out) { |
| 35 | entry: |
| 36 | ; CHECK-LABEL: load_neg_255: |
| 37 | ; CHECK: vldr.16 {{s[0-9]+}}, [r0, #-510] |
| 38 | %arrayidx = getelementptr inbounds half, half* %in, i32 -255 |
| 39 | %load = load half, half* %arrayidx, align 2 |
| 40 | store half %load, half* %out |
| 41 | ret void |
| 42 | } |
| 43 | |
| 44 | define void @load_neg_256(half* %in, half* %out) { |
| 45 | entry: |
| 46 | ; CHECK-LABEL: load_neg_256: |
| 47 | ; CHECK: sub [[ADDR:r[0-9]+]], r0, #512 |
| 48 | ; CHECK: vldr.16 {{s[0-9]+}}, {{\[}}[[ADDR]]{{\]}} |
| 49 | %arrayidx = getelementptr inbounds half, half* %in, i32 -256 |
| 50 | %load = load half, half* %arrayidx, align 2 |
| 51 | store half %load, half* %out |
| 52 | ret void |
| 53 | } |
| 54 | |
| 55 | define void @store_zero(half* %in, half* %out) { |
| 56 | entry: |
| 57 | ; CHECK-LABEL: store_zero: |
| 58 | %load = load half, half* %in, align 2 |
| 59 | ; CHECK: vstr.16 {{s[0-9]+}}, [r1] |
| 60 | %arrayidx = getelementptr inbounds half, half* %out, i32 0 |
| 61 | store half %load, half* %arrayidx |
| 62 | ret void |
| 63 | } |
| 64 | |
| 65 | define void @store_255(half* %in, half* %out) { |
| 66 | entry: |
| 67 | ; CHECK-LABEL: store_255: |
| 68 | %load = load half, half* %in, align 2 |
| 69 | ; CHECK: vstr.16 {{s[0-9]+}}, [r1, #510] |
| 70 | %arrayidx = getelementptr inbounds half, half* %out, i32 255 |
| 71 | store half %load, half* %arrayidx |
| 72 | ret void |
| 73 | } |
| 74 | |
| 75 | define void @store_256(half* %in, half* %out) { |
| 76 | entry: |
| 77 | ; CHECK-LABEL: store_256: |
| 78 | %load = load half, half* %in, align 2 |
| 79 | ; CHECK: add [[ADDR:r[0-9]+]], r1, #512 |
| 80 | ; CHECK: vstr.16 {{s[0-9]+}}, {{\[}}[[ADDR]]{{\]}} |
| 81 | %arrayidx = getelementptr inbounds half, half* %out, i32 256 |
| 82 | store half %load, half* %arrayidx |
| 83 | ret void |
| 84 | } |
| 85 | |
| 86 | define void @store_neg_255(half* %in, half* %out) { |
| 87 | entry: |
| 88 | ; CHECK-LABEL: store_neg_255: |
| 89 | %load = load half, half* %in, align 2 |
| 90 | ; CHECK: vstr.16 {{s[0-9]+}}, [r1, #-510] |
| 91 | %arrayidx = getelementptr inbounds half, half* %out, i32 -255 |
| 92 | store half %load, half* %arrayidx |
| 93 | ret void |
| 94 | } |
| 95 | |
| 96 | define void @store_neg_256(half* %in, half* %out) { |
| 97 | entry: |
| 98 | ; CHECK-LABEL: store_neg_256: |
| 99 | %load = load half, half* %in, align 2 |
| 100 | ; CHECK: sub [[ADDR:r[0-9]+]], r1, #512 |
| 101 | ; CHECK: vstr.16 {{s[0-9]+}}, {{\[}}[[ADDR]]{{\]}} |
| 102 | %arrayidx = getelementptr inbounds half, half* %out, i32 -256 |
| 103 | store half %load, half* %arrayidx |
| 104 | ret void |
| 105 | } |