Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/mul.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

194 lines
5.3 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32
define i32 @mul_i32(i32 %x, i32 %y) {
; MIPS32-LABEL: mul_i32:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: mul $2, $4, $5
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
entry:
%z = mul i32 %x, %y
ret i32 %z
}
define signext i8 @mul_i8_sext(i8 signext %a, i8 signext %b) {
; MIPS32-LABEL: mul_i8_sext:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: mul $1, $5, $4
; MIPS32-NEXT: sll $1, $1, 24
; MIPS32-NEXT: sra $2, $1, 24
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
entry:
%mul = mul i8 %b, %a
ret i8 %mul
}
define zeroext i8 @mul_i8_zext(i8 zeroext %a, i8 zeroext %b) {
; MIPS32-LABEL: mul_i8_zext:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: mul $1, $5, $4
; MIPS32-NEXT: andi $2, $1, 255
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
entry:
%mul = mul i8 %b, %a
ret i8 %mul
}
define i8 @mul_i8_aext(i8 %a, i8 %b) {
; MIPS32-LABEL: mul_i8_aext:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: mul $2, $5, $4
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
entry:
%mul = mul i8 %b, %a
ret i8 %mul
}
define signext i16 @mul_i16_sext(i16 signext %a, i16 signext %b) {
; MIPS32-LABEL: mul_i16_sext:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: mul $1, $5, $4
; MIPS32-NEXT: sll $1, $1, 16
; MIPS32-NEXT: sra $2, $1, 16
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
entry:
%mul = mul i16 %b, %a
ret i16 %mul
}
define zeroext i16 @mul_i16_zext(i16 zeroext %a, i16 zeroext %b) {
; MIPS32-LABEL: mul_i16_zext:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: mul $1, $5, $4
; MIPS32-NEXT: andi $2, $1, 65535
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
entry:
%mul = mul i16 %b, %a
ret i16 %mul
}
define i16 @mul_i16_aext(i16 %a, i16 %b) {
; MIPS32-LABEL: mul_i16_aext:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: mul $2, $5, $4
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
entry:
%mul = mul i16 %b, %a
ret i16 %mul
}
define i64 @mul_i64(i64 %a, i64 %b) {
; MIPS32-LABEL: mul_i64:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: move $3, $4
; MIPS32-NEXT: mul $2, $6, $3
; MIPS32-NEXT: multu $6, $3
; MIPS32-NEXT: mfhi $1
; MIPS32-NEXT: mul $4, $6, $5
; MIPS32-NEXT: mul $3, $7, $3
; MIPS32-NEXT: addu $1, $1, $4
; MIPS32-NEXT: addu $3, $1, $3
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
entry:
%mul = mul i64 %b, %a
ret i64 %mul
}
define i128 @mul_i128(i128 %a, i128 %b) {
; MIPS32-LABEL: mul_i128:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: move $12, $4
; MIPS32-NEXT: move $13, $5
; MIPS32-NEXT: move $14, $6
; MIPS32-NEXT: move $15, $7
; MIPS32-NEXT: addiu $1, $sp, 16
; MIPS32-NEXT: lw $9, 0($1)
; MIPS32-NEXT: addiu $1, $sp, 20
; MIPS32-NEXT: lw $8, 0($1)
; MIPS32-NEXT: addiu $1, $sp, 24
; MIPS32-NEXT: lw $7, 0($1)
; MIPS32-NEXT: addiu $1, $sp, 28
; MIPS32-NEXT: lw $6, 0($1)
; MIPS32-NEXT: mul $2, $9, $12
; MIPS32-NEXT: multu $9, $12
; MIPS32-NEXT: mfhi $3
; MIPS32-NEXT: mul $1, $9, $13
; MIPS32-NEXT: mul $4, $8, $12
; MIPS32-NEXT: addu $3, $3, $1
; MIPS32-NEXT: sltu $1, $3, $1
; MIPS32-NEXT: addu $3, $3, $4
; MIPS32-NEXT: sltu $4, $3, $4
; MIPS32-NEXT: addu $5, $1, $4
; MIPS32-NEXT: multu $8, $12
; MIPS32-NEXT: mfhi $4
; MIPS32-NEXT: multu $9, $13
; MIPS32-NEXT: mfhi $1
; MIPS32-NEXT: mul $24, $9, $14
; MIPS32-NEXT: mul $11, $8, $13
; MIPS32-NEXT: mul $10, $7, $12
; MIPS32-NEXT: addu $4, $4, $1
; MIPS32-NEXT: sltu $1, $4, $1
; MIPS32-NEXT: addu $4, $4, $24
; MIPS32-NEXT: sltu $24, $4, $24
; MIPS32-NEXT: addu $1, $1, $24
; MIPS32-NEXT: addu $4, $4, $11
; MIPS32-NEXT: sltu $11, $4, $11
; MIPS32-NEXT: addu $1, $1, $11
; MIPS32-NEXT: addu $4, $4, $10
; MIPS32-NEXT: sltu $10, $4, $10
; MIPS32-NEXT: addu $1, $1, $10
; MIPS32-NEXT: addu $4, $4, $5
; MIPS32-NEXT: sltu $5, $4, $5
; MIPS32-NEXT: addu $5, $1, $5
; MIPS32-NEXT: multu $7, $12
; MIPS32-NEXT: mfhi $1
; MIPS32-NEXT: multu $8, $13
; MIPS32-NEXT: mfhi $11
; MIPS32-NEXT: multu $9, $14
; MIPS32-NEXT: mfhi $10
; MIPS32-NEXT: mul $9, $9, $15
; MIPS32-NEXT: mul $8, $8, $14
; MIPS32-NEXT: mul $7, $7, $13
; MIPS32-NEXT: mul $6, $6, $12
; MIPS32-NEXT: addu $1, $1, $11
; MIPS32-NEXT: addu $1, $1, $10
; MIPS32-NEXT: addu $1, $1, $9
; MIPS32-NEXT: addu $1, $1, $8
; MIPS32-NEXT: addu $1, $1, $7
; MIPS32-NEXT: addu $1, $1, $6
; MIPS32-NEXT: addu $5, $1, $5
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
entry:
%mul = mul i128 %b, %a
ret i128 %mul
}
declare { i32, i1 } @llvm.umul.with.overflow.i32(i32, i32)
define void @umul_with_overflow(i32 %lhs, i32 %rhs, ptr %pmul, ptr %pcarry_flag) {
; MIPS32-LABEL: umul_with_overflow:
; MIPS32: # %bb.0:
; MIPS32-NEXT: multu $4, $5
; MIPS32-NEXT: mfhi $2
; MIPS32-NEXT: mul $1, $4, $5
; MIPS32-NEXT: sltu $2, $zero, $2
; MIPS32-NEXT: andi $2, $2, 1
; MIPS32-NEXT: sb $2, 0($7)
; MIPS32-NEXT: sw $1, 0($6)
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
%res = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %lhs, i32 %rhs)
%carry_flag = extractvalue { i32, i1 } %res, 1
%mul = extractvalue { i32, i1 } %res, 0
store i1 %carry_flag, ptr %pcarry_flag
store i32 %mul, ptr %pmul
ret void
}