1 ; Test high-part i32->i64 multiplications.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; We don't provide *MUL_LOHI or MULH* for the patterns in this file,
6 ; but they should at least still work.
8 ; Check zero-extended multiplication in which only the high part is used.
9 define i32 @f1(i32 %a, i32 %b) {
13 %ax = zext i32 %a to i64
14 %bx = zext i32 %b to i64
15 %mulx = mul i64 %ax, %bx
16 %highx = lshr i64 %mulx, 32
17 %high = trunc i64 %highx to i32
21 ; Check sign-extended multiplication in which only the high part is used.
22 define i32 @f2(i32 %a, i32 %b) {
26 %ax = sext i32 %a to i64
27 %bx = sext i32 %b to i64
28 %mulx = mul i64 %ax, %bx
29 %highx = lshr i64 %mulx, 32
30 %high = trunc i64 %highx to i32
34 ; Check zero-extended multiplication in which the result is split into
35 ; high and low halves.
36 define i32 @f3(i32 %a, i32 %b) {
40 %ax = zext i32 %a to i64
41 %bx = zext i32 %b to i64
42 %mulx = mul i64 %ax, %bx
43 %highx = lshr i64 %mulx, 32
44 %high = trunc i64 %highx to i32
45 %low = trunc i64 %mulx to i32
46 %or = or i32 %high, %low
50 ; Check sign-extended multiplication in which the result is split into
51 ; high and low halves.
52 define i32 @f4(i32 %a, i32 %b) {
56 %ax = sext i32 %a to i64
57 %bx = sext i32 %b to i64
58 %mulx = mul i64 %ax, %bx
59 %highx = lshr i64 %mulx, 32
60 %high = trunc i64 %highx to i32
61 %low = trunc i64 %mulx to i32
62 %or = or i32 %high, %low