1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; Test i128 byteswaps on z15 and higher.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z15 | FileCheck %s
6 declare i128 @llvm.bswap.i128(i128 %a)
8 ; Check 128-bit register-to-register byteswaps.
9 define i128 @f1(i128 %a, i128 %b, i128 %c) {
12 ; CHECK-NEXT: vl %v1, 0(%r4), 3
13 ; CHECK-NEXT: vl %v2, 0(%r3), 3
14 ; CHECK-NEXT: larl %r1, .LCPI0_0
15 ; CHECK-NEXT: vaq %v1, %v2, %v1
16 ; CHECK-NEXT: vl %v2, 0(%r1), 3
17 ; CHECK-NEXT: vl %v0, 0(%r5), 3
18 ; CHECK-NEXT: vperm %v1, %v1, %v1, %v2
19 ; CHECK-NEXT: vaq %v0, %v1, %v0
20 ; CHECK-NEXT: vst %v0, 0(%r2), 3
23 %swapped = call i128 @llvm.bswap.i128(i128 %in)
24 %out = add i128 %swapped, %c
28 ; Check 128-bit register-to-memory byteswaps.
29 define i128 @f2(i128 %a, i128 %b) {
32 ; CHECK-NEXT: vl %v0, 0(%r4), 3
33 ; CHECK-NEXT: vl %v1, 0(%r3), 3
34 ; CHECK-NEXT: vaq %v0, %v1, %v0
35 ; CHECK-NEXT: vstbrq %v0, 0(%r2)
38 %swapped = call i128 @llvm.bswap.i128(i128 %in)
42 ; Check 128-bit memory-to-register byteswaps.
43 define i128 @f3(i128 %a, i128 %b) {
46 ; CHECK-NEXT: vl %v0, 0(%r4), 3
47 ; CHECK-NEXT: vlbrq %v1, 0(%r3)
48 ; CHECK-NEXT: vaq %v0, %v1, %v0
49 ; CHECK-NEXT: vst %v0, 0(%r2), 3
51 %swapped = call i128 @llvm.bswap.i128(i128 %a)
52 %out = add i128 %swapped, %b