65 lines · plain
1; Test high-part i32->i64 multiplications.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s4 5; We don't provide *MUL_LOHI or MULH* for the patterns in this file,6; but they should at least still work.7 8; Check zero-extended multiplication in which only the high part is used.9define i32 @f1(i32 %a, i32 %b) {10; CHECK-LABEL: f1:11; CHECK: msgr12; CHECK: br %r1413 %ax = zext i32 %a to i6414 %bx = zext i32 %b to i6415 %mulx = mul i64 %ax, %bx16 %highx = lshr i64 %mulx, 3217 %high = trunc i64 %highx to i3218 ret i32 %high19}20 21; Check sign-extended multiplication in which only the high part is used.22define i32 @f2(i32 %a, i32 %b) {23; CHECK-LABEL: f2:24; CHECK: msgfr25; CHECK: br %r1426 %ax = sext i32 %a to i6427 %bx = sext i32 %b to i6428 %mulx = mul i64 %ax, %bx29 %highx = lshr i64 %mulx, 3230 %high = trunc i64 %highx to i3231 ret i32 %high32}33 34; Check zero-extended multiplication in which the result is split into35; high and low halves.36define i32 @f3(i32 %a, i32 %b) {37; CHECK-LABEL: f3:38; CHECK: msgr39; CHECK: br %r1440 %ax = zext i32 %a to i6441 %bx = zext i32 %b to i6442 %mulx = mul i64 %ax, %bx43 %highx = lshr i64 %mulx, 3244 %high = trunc i64 %highx to i3245 %low = trunc i64 %mulx to i3246 %or = or i32 %high, %low47 ret i32 %or48}49 50; Check sign-extended multiplication in which the result is split into51; high and low halves.52define i32 @f4(i32 %a, i32 %b) {53; CHECK-LABEL: f4:54; CHECK: msgfr55; CHECK: br %r1456 %ax = sext i32 %a to i6457 %bx = sext i32 %b to i6458 %mulx = mul i64 %ax, %bx59 %highx = lshr i64 %mulx, 3260 %high = trunc i64 %highx to i3261 %low = trunc i64 %mulx to i3262 %or = or i32 %high, %low63 ret i32 %or64}65