
On processors supporting vector registers and SIMD instructions, enable i128 as legal type in VRs. This allows many operations to be implemented via native instructions directly in VRs (including add, subtract, logical operations and shifts). For a few other operations (e.g. multiply and divide, as well as atomic operations), we need to move the i128 value back to a GPR pair to use the corresponding instruction there. Overall, this is still beneficial. The patch includes the following LLVM changes: - Enable i128 as legal type - Set up legal operations (in SystemZInstrVector.td) - Custom expansion for i128 add/subtract with carry - Custom expansion for i128 comparisons and selects - Support for moving i128 to/from GPR pairs when required - Handle 128-bit integer constant values everywhere - Use i128 as intrinsic operand type where appropriate - Updated and new test cases In addition, clang builtins are updated to reflect the intrinsic operand type changes (which also improves compatibility with GCC).
48 lines
1.1 KiB
LLVM
48 lines
1.1 KiB
LLVM
; Test loading of 128-bit constants in vector registers on z13
|
|
;
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
|
|
|
|
; Constant zero.
|
|
define i128 @f1() {
|
|
; CHECK-LABEL: f1:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: vgbm %v0, 0
|
|
; CHECK-NEXT: vst %v0, 0(%r2), 3
|
|
; CHECK-NEXT: br %r14
|
|
ret i128 0
|
|
}
|
|
|
|
; Constant created using VBGM.
|
|
define i128 @f2() {
|
|
; CHECK-LABEL: f2:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: vgbm %v0, 1
|
|
; CHECK-NEXT: vst %v0, 0(%r2), 3
|
|
; CHECK-NEXT: br %r14
|
|
ret i128 255
|
|
}
|
|
|
|
; Constant created using VREPIB.
|
|
define i128 @f3() {
|
|
; CHECK-LABEL: f3:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: vrepib %v0, 1
|
|
; CHECK-NEXT: vst %v0, 0(%r2), 3
|
|
; CHECK-NEXT: br %r14
|
|
ret i128 1334440654591915542993625911497130241
|
|
}
|
|
|
|
; Constant loaded from literal pool.
|
|
define i128 @f4() {
|
|
; CHECK-LABEL: .LCPI3_0:
|
|
; CHECK-NEXT: .quad 54210108624275221
|
|
; CHECK-NEXT: .quad -5527149226598858752
|
|
; CHECK-LABEL: f4:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: larl %r1, .LCPI3_0
|
|
; CHECK-NEXT: vl %v0, 0(%r1), 3
|
|
; CHECK-NEXT: vst %v0, 0(%r2), 3
|
|
; CHECK-NEXT: br %r14
|
|
ret i128 1000000000000000000000000000000000000
|
|
}
|