reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
; Test stores of byte-swapped vector elements.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z15 | FileCheck %s

declare <8 x i16> @llvm.bswap.v8i16(<8 x i16>)
declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>)
declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)

; Test v8i16 stores.
define void @f1(<8 x i16> %val, <8 x i16> *%ptr) {
; CHECK-LABEL: f1:
; CHECK: vstbrh %v24, 0(%r2)
; CHECK: br %r14
  %swap = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %val)
  store <8 x i16> %swap, <8 x i16> *%ptr
  ret void
}

; Test v4i32 stores.
define void @f2(<4 x i32> %val, <4 x i32> *%ptr) {
; CHECK-LABEL: f2:
; CHECK: vstbrf %v24, 0(%r2)
; CHECK: br %r14
  %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
  store <4 x i32> %swap, <4 x i32> *%ptr
  ret void
}

; Test v2i64 stores.
define void @f3(<2 x i64> %val, <2 x i64> *%ptr) {
; CHECK-LABEL: f3:
; CHECK: vstbrg %v24, 0(%r2)
; CHECK: br %r14
  %swap = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %val)
  store <2 x i64> %swap, <2 x i64> *%ptr
  ret void
}

; Test the highest aligned in-range offset.
define void @f4(<4 x i32> %val, <4 x i32> *%base) {
; CHECK-LABEL: f4:
; CHECK: vstbrf %v24, 4080(%r2)
; CHECK: br %r14
  %ptr = getelementptr <4 x i32>, <4 x i32> *%base, i64 255
  %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
  store <4 x i32> %swap, <4 x i32> *%ptr
  ret void
}

; Test the highest unaligned in-range offset.
define void @f5(<4 x i32> %val, i8 *%base) {
; CHECK-LABEL: f5:
; CHECK: vstbrf %v24, 4095(%r2)
; CHECK: br %r14
  %addr = getelementptr i8, i8 *%base, i64 4095
  %ptr = bitcast i8 *%addr to <4 x i32> *
  %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
  store <4 x i32> %swap, <4 x i32> *%ptr, align 1
  ret void
}

; Test the next offset up, which requires separate address logic,
define void @f6(<4 x i32> %val, <4 x i32> *%base) {
; CHECK-LABEL: f6:
; CHECK: aghi %r2, 4096
; CHECK: vstbrf %v24, 0(%r2)
; CHECK: br %r14
  %ptr = getelementptr <4 x i32>, <4 x i32> *%base, i64 256
  %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
  store <4 x i32> %swap, <4 x i32> *%ptr
  ret void
}

; Test negative offsets, which also require separate address logic,
define void @f7(<4 x i32> %val, <4 x i32> *%base) {
; CHECK-LABEL: f7:
; CHECK: aghi %r2, -16
; CHECK: vstbrf %v24, 0(%r2)
; CHECK: br %r14
  %ptr = getelementptr <4 x i32>, <4 x i32> *%base, i64 -1
  %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
  store <4 x i32> %swap, <4 x i32> *%ptr
  ret void
}

; Check that indexes are allowed.
define void @f8(<4 x i32> %val, i8 *%base, i64 %index) {
; CHECK-LABEL: f8:
; CHECK: vstbrf %v24, 0(%r3,%r2)
; CHECK: br %r14
  %addr = getelementptr i8, i8 *%base, i64 %index
  %ptr = bitcast i8 *%addr to <4 x i32> *
  %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
  store <4 x i32> %swap, <4 x i32> *%ptr, align 1
  ret void
}