1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -aarch64-sve-vector-bits-min=256 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_256
; RUN: llc -aarch64-sve-vector-bits-min=512 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
; RUN: llc -aarch64-sve-vector-bits-min=2048 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
target triple = "aarch64-unknown-linux-gnu"
; Don't use SVE for 128-bit vectors.
define void @sabd_v16i8_v16i16(ptr %a, ptr %b) #0 {
; CHECK-LABEL: sabd_v16i8_v16i16:
; CHECK: // %bb.0:
; CHECK-NEXT: ldr q0, [x0]
; CHECK-NEXT: ldr q1, [x1]
; CHECK-NEXT: sabd v0.16b, v0.16b, v1.16b
; CHECK-NEXT: str q0, [x0]
; CHECK-NEXT: ret
%a.ld = load <16 x i8>, ptr %a
%b.ld = load <16 x i8>, ptr %b
%a.sext = sext <16 x i8> %a.ld to <16 x i16>
%b.sext = sext <16 x i8> %b.ld to <16 x i16>
%sub = sub <16 x i16> %a.sext, %b.sext
%abs = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %sub, i1 true)
%trunc = trunc <16 x i16> %abs to <16 x i8>
store <16 x i8> %trunc, ptr %a
ret void
}
; Don't use SVE for 128-bit vectors.
define void @sabd_v16i8_v16i32(ptr %a, ptr %b) #0 {
; CHECK-LABEL: sabd_v16i8_v16i32:
; CHECK: // %bb.0:
; CHECK-NEXT: ldr q0, [x0]
; CHECK-NEXT: ldr q1, [x1]
; CHECK-NEXT: sabd v0.16b, v0.16b, v1.16b
; CHECK-NEXT: str q0, [x0]
; CHECK-NEXT: ret
%a.ld = load <16 x i8>, ptr %a
%b.ld = load <16 x i8>, ptr %b
%a.sext = sext <16 x i8> %a.ld to <16 x i32>
%b.sext = sext <16 x i8> %b.ld to <16 x i32>
%sub = sub <16 x i32> %a.sext, %b.sext
%abs = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %sub, i1 true)
%trunc = trunc <16 x i32> %abs to <16 x i8>
store <16 x i8> %trunc, ptr %a
ret void
}
; Don't use SVE for 128-bit vectors.
define void @sabd_v16i8_v16i64(ptr %a, ptr %b) #0 {
; CHECK-LABEL: sabd_v16i8_v16i64:
; CHECK: // %bb.0:
; CHECK-NEXT: ldr q0, [x0]
; CHECK-NEXT: ldr q1, [x1]
; CHECK-NEXT: sabd v0.16b, v0.16b, v1.16b
; CHECK-NEXT: str q0, [x0]
; CHECK-NEXT: ret
%a.ld = load <16 x i8>, ptr %a
%b.ld = load <16 x i8>, ptr %b
%a.sext = sext <16 x i8> %a.ld to <16 x i64>
%b.sext = sext <16 x i8> %b.ld to <16 x i64>
%sub = sub <16 x i64> %a.sext, %b.sext
%abs = call <16 x i64> @llvm.abs.v16i64(<16 x i64> %sub, i1 true)
%trunc = trunc <16 x i64> %abs to <16 x i8>
store <16 x i8> %trunc, ptr %a
ret void
}
define void @sabd_v32i8_v32i16(ptr %a, ptr %b) #0 {
; CHECK-LABEL: sabd_v32i8_v32i16:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.b, vl32
; CHECK-NEXT: ld1b { z0.b }, p0/z, [x0]
; CHECK-NEXT: ld1b { z1.b }, p0/z, [x1]
; CHECK-NEXT: sabd z0.b, p0/m, z0.b, z1.b
; CHECK-NEXT: st1b { z0.b }, p0, [x0]
; CHECK-NEXT: ret
%a.ld = load <32 x i8>, ptr %a
%b.ld = load <32 x i8>, ptr %b
%a.sext = sext <32 x i8> %a.ld to <32 x i16>
%b.sext = sext <32 x i8> %b.ld to <32 x i16>
%sub = sub <32 x i16> %a.sext, %b.sext
%abs = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %sub, i1 true)
%trunc = trunc <32 x i16> %abs to <32 x i8>
store <32 x i8> %trunc, ptr %a
ret void
}
define void @uabd_v32i8_v32i16(ptr %a, ptr %b) #0 {
; CHECK-LABEL: uabd_v32i8_v32i16:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.b, vl32
; CHECK-NEXT: ld1b { z0.b }, p0/z, [x0]
; CHECK-NEXT: ld1b { z1.b }, p0/z, [x1]
; CHECK-NEXT: uabd z0.b, p0/m, z0.b, z1.b
; CHECK-NEXT: st1b { z0.b }, p0, [x0]
; CHECK-NEXT: ret
%a.ld = load <32 x i8>, ptr %a
%b.ld = load <32 x i8>, ptr %b
%a.zext = zext <32 x i8> %a.ld to <32 x i16>
%b.zext = zext <32 x i8> %b.ld to <32 x i16>
%sub = sub <32 x i16> %a.zext, %b.zext
%abs = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %sub, i1 true)
%trunc = trunc <32 x i16> %abs to <32 x i8>
store <32 x i8> %trunc, ptr %a
ret void
}
define void @sabd_v32i8_v32i32(ptr %a, ptr %b) #0 {
; CHECK-LABEL: sabd_v32i8_v32i32:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.b, vl32
; CHECK-NEXT: ld1b { z0.b }, p0/z, [x0]
; CHECK-NEXT: ld1b { z1.b }, p0/z, [x1]
; CHECK-NEXT: sabd z0.b, p0/m, z0.b, z1.b
; CHECK-NEXT: st1b { z0.b }, p0, [x0]
; CHECK-NEXT: ret
%a.ld = load <32 x i8>, ptr %a
%b.ld = load <32 x i8>, ptr %b
%a.sext = sext <32 x i8> %a.ld to <32 x i32>
%b.sext = sext <32 x i8> %b.ld to <32 x i32>
%sub = sub <32 x i32> %a.sext, %b.sext
%abs = call <32 x i32> @llvm.abs.v32i32(<32 x i32> %sub, i1 true)
%trunc = trunc <32 x i32> %abs to <32 x i8>
store <32 x i8> %trunc, ptr %a
ret void
}
define void @sabd_v32i8_v32i64(ptr %a, ptr %b) #0 {
; CHECK-LABEL: sabd_v32i8_v32i64:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.b, vl32
; CHECK-NEXT: ld1b { z0.b }, p0/z, [x0]
; CHECK-NEXT: ld1b { z1.b }, p0/z, [x1]
; CHECK-NEXT: sabd z0.b, p0/m, z0.b, z1.b
; CHECK-NEXT: st1b { z0.b }, p0, [x0]
; CHECK-NEXT: ret
%a.ld = load <32 x i8>, ptr %a
%b.ld = load <32 x i8>, ptr %b
%a.sext = sext <32 x i8> %a.ld to <32 x i64>
%b.sext = sext <32 x i8> %b.ld to <32 x i64>
%sub = sub <32 x i64> %a.sext, %b.sext
%abs = call <32 x i64> @llvm.abs.v32i64(<32 x i64> %sub, i1 true)
%trunc = trunc <32 x i64> %abs to <32 x i8>
store <32 x i8> %trunc, ptr %a
ret void
}
define void @sabd_v64i8_v64i64(ptr %a, ptr %b) #0 {
; VBITS_GE_256-LABEL: sabd_v64i8_v64i64:
; VBITS_GE_256: // %bb.0:
; VBITS_GE_256-NEXT: ptrue p0.b, vl32
; VBITS_GE_256-NEXT: mov w8, #32 // =0x20
; VBITS_GE_256-NEXT: ld1b { z0.b }, p0/z, [x0, x8]
; VBITS_GE_256-NEXT: ld1b { z1.b }, p0/z, [x1, x8]
; VBITS_GE_256-NEXT: ld1b { z2.b }, p0/z, [x0]
; VBITS_GE_256-NEXT: ld1b { z3.b }, p0/z, [x1]
; VBITS_GE_256-NEXT: sabd z0.b, p0/m, z0.b, z1.b
; VBITS_GE_256-NEXT: movprfx z1, z2
; VBITS_GE_256-NEXT: sabd z1.b, p0/m, z1.b, z3.b
; VBITS_GE_256-NEXT: st1b { z0.b }, p0, [x0, x8]
; VBITS_GE_256-NEXT: st1b { z1.b }, p0, [x0]
; VBITS_GE_256-NEXT: ret
;
; VBITS_GE_512-LABEL: sabd_v64i8_v64i64:
; VBITS_GE_512: // %bb.0:
; VBITS_GE_512-NEXT: ptrue p0.b, vl64
; VBITS_GE_512-NEXT: ld1b { z0.b }, p0/z, [x0]
; VBITS_GE_512-NEXT: ld1b { z1.b }, p0/z, [x1]
; VBITS_GE_512-NEXT: sabd z0.b, p0/m, z0.b, z1.b
; VBITS_GE_512-NEXT: st1b { z0.b }, p0, [x0]
; VBITS_GE_512-NEXT: ret
%a.ld = load <64 x i8>, ptr %a
%b.ld = load <64 x i8>, ptr %b
%a.sext = sext <64 x i8> %a.ld to <64 x i64>
%b.sext = sext <64 x i8> %b.ld to <64 x i64>
%sub = sub <64 x i64> %a.sext, %b.sext
%abs = call <64 x i64> @llvm.abs.v64i64(<64 x i64> %sub, i1 true)
%trunc = trunc <64 x i64> %abs to <64 x i8>
store <64 x i8> %trunc, ptr %a
ret void
}
attributes #0 = { "target-features"="+neon,+sve" }
|