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
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
; Test high-part i128->i256 multiplications on z17.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z17 | FileCheck %s
; Multiply high signed.
define i128 @f1(i128 %a, i128 %b) {
; CHECK-LABEL: f1:
; CHECK: # %bb.0:
; CHECK-NEXT: vl %v0, 0(%r4), 3
; CHECK-NEXT: vl %v1, 0(%r3), 3
; CHECK-NEXT: vmhq %v0, %v1, %v0
; CHECK-NEXT: vst %v0, 0(%r2), 3
; CHECK-NEXT: br %r14
%exta = sext i128 %a to i256
%extb = sext i128 %b to i256
%extres = mul i256 %exta, %extb
%shiftres = lshr i256 %extres, 128
%res = trunc i256 %shiftres to i128
ret i128 %res
}
; Multiply high unsigned.
define i128 @f2(i128 %a, i128 %b) {
; CHECK-LABEL: f2:
; CHECK: # %bb.0:
; CHECK-NEXT: vl %v0, 0(%r4), 3
; CHECK-NEXT: vl %v1, 0(%r3), 3
; CHECK-NEXT: vmlhq %v0, %v1, %v0
; CHECK-NEXT: vst %v0, 0(%r2), 3
; CHECK-NEXT: br %r14
%exta = zext i128 %a to i256
%extb = zext i128 %b to i256
%extres = mul i256 %exta, %extb
%shiftres = lshr i256 %extres, 128
%res = trunc i256 %shiftres to i128
ret i128 %res
}
;; ; Multiply-and-add high signed.
;; define i128 @f3(i128 %a, i128 %b, i128 %add) {
;; ; CHECX-LABEL: f3:
;; ; CHECX: # %bb.0:
;; ; CHECX-NEXT: vl %v0, 0(%r3), 3
;; ; CHECX-NEXT: vl %v1, 0(%r4), 3
;; ; CHECX-NEXT: vl %v2, 0(%r5), 3
;; ; CHECX-NEXT: vmhq %v0, %v0, %v1, %v2
;; ; CHECX-NEXT: vst %v0, 0(%r2), 3
;; ; CHECX-NEXT: br %r14
;; %exta = sext i128 %a to i256
;; %extb = sext i128 %b to i256
;; %extadd = sext i128 %add to i256
;; %extmul = mul i256 %exta, %extb
;; %extres = add i256 %extmul, %extadd
;; %shiftres = lshr i256 %extres, 128
;; %res = trunc i256 %shiftres to i128
;; ret i128 %res
;; }
|