Files
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

151 lines
4.9 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
;-----------------------------------------------------------------------------
; Simple test using scalar layout.
;-----------------------------------------------------------------------------
declare i32 @llvm.smul.fix.i32(i32, i32, i32)
define i32 @test_smul_fix_i32_0() {
; CHECK-LABEL: @test_smul_fix_i32_0(
; CHECK-NEXT: ret i32 536870912
;
%r = call i32 @llvm.smul.fix.i32(i32 1073741824, i32 1073741824, i32 31) ; 0.5 * 0.5
ret i32 %r
}
define i32 @test_smul_fix_i32_undef_x() {
; CHECK-LABEL: @test_smul_fix_i32_undef_x(
; CHECK-NEXT: ret i32 0
;
%r = call i32 @llvm.smul.fix.i32(i32 undef, i32 1073741824, i32 31) ; undef * 0.5
ret i32 %r
}
define i32 @test_smul_fix_i32_x_undef() {
; CHECK-LABEL: @test_smul_fix_i32_x_undef(
; CHECK-NEXT: ret i32 0
;
%r = call i32 @llvm.smul.fix.i32(i32 1073741824, i32 undef, i32 31)
ret i32 %r
}
;-----------------------------------------------------------------------------
; More extensive tests based on vectors (basically using the scalar fold
; for each index).
;-----------------------------------------------------------------------------
declare <8 x i3> @llvm.smul.fix.v8i3(<8 x i3>, <8 x i3>, i32)
define <8 x i3> @test_smul_fix_v8i3_0() {
; CHECK-LABEL: @test_smul_fix_v8i3_0(
; CHECK-NEXT: ret <8 x i3> <i3 0, i3 -4, i3 0, i3 -4, i3 0, i3 -4, i3 0, i3 -4>
;
%r = call <8 x i3> @llvm.smul.fix.v8i3(
<8 x i3> <i3 -4, i3 -3, i3 -2, i3 -1, i3 0, i3 1, i3 2, i3 3>,
<8 x i3> <i3 -4, i3 -4, i3 -4, i3 -4, i3 -4, i3 -4, i3 -4, i3 -4>,
i32 0)
ret <8 x i3> %r
}
define <8 x i3> @test_smul_fix_v8i3_1() {
; CHECK-LABEL: @test_smul_fix_v8i3_1(
; CHECK-NEXT: ret <8 x i3> <i3 0, i3 -2, i3 -4, i3 2, i3 0, i3 -2, i3 -4, i3 2>
;
%r = call <8 x i3> @llvm.smul.fix.v8i3(
<8 x i3> <i3 -4, i3 -3, i3 -2, i3 -1, i3 0, i3 1, i3 2, i3 3>,
<8 x i3> <i3 -4, i3 -4, i3 -4, i3 -4, i3 -4, i3 -4, i3 -4, i3 -4>,
i32 1)
ret <8 x i3> %r
}
define <8 x i3> @test_smul_fix_v8i3_2() {
; CHECK-LABEL: @test_smul_fix_v8i3_2(
; CHECK-NEXT: ret <8 x i3> <i3 -4, i3 3, i3 2, i3 1, i3 0, i3 -1, i3 -2, i3 -3>
;
%r = call <8 x i3> @llvm.smul.fix.v8i3(
<8 x i3> <i3 -4, i3 -3, i3 -2, i3 -1, i3 0, i3 1, i3 2, i3 3>,
<8 x i3> <i3 -4, i3 -4, i3 -4, i3 -4, i3 -4, i3 -4, i3 -4, i3 -4>,
i32 2)
ret <8 x i3> %r
}
define <8 x i3> @test_smul_fix_v8i3_3() {
; CHECK-LABEL: @test_smul_fix_v8i3_3(
; CHECK-NEXT: ret <8 x i3> <i3 -4, i3 3, i3 2, i3 1, i3 0, i3 -1, i3 -2, i3 -3>
;
%r = call <8 x i3> @llvm.smul.fix.v8i3(
<8 x i3> <i3 -4, i3 -3, i3 -2, i3 -1, i3 0, i3 1, i3 2, i3 3>,
<8 x i3> <i3 -1, i3 -1, i3 -1, i3 -1, i3 -1, i3 -1, i3 -1, i3 -1>,
i32 0)
ret <8 x i3> %r
}
define <8 x i3> @test_smul_fix_v8i3_4() {
; CHECK-LABEL: @test_smul_fix_v8i3_4(
; CHECK-NEXT: ret <8 x i3> <i3 2, i3 1, i3 1, i3 0, i3 0, i3 -1, i3 -1, i3 -2>
;
%r = call <8 x i3> @llvm.smul.fix.v8i3(
<8 x i3> <i3 -4, i3 -3, i3 -2, i3 -1, i3 0, i3 1, i3 2, i3 3>,
<8 x i3> <i3 -1, i3 -1, i3 -1, i3 -1, i3 -1, i3 -1, i3 -1, i3 -1>,
i32 1)
ret <8 x i3> %r
}
define <8 x i3> @test_smul_fix_v8i3_5() {
; CHECK-LABEL: @test_smul_fix_v8i3_5(
; CHECK-NEXT: ret <8 x i3> <i3 1, i3 0, i3 0, i3 0, i3 0, i3 -1, i3 -1, i3 -1>
;
%r = call <8 x i3> @llvm.smul.fix.v8i3(
<8 x i3> <i3 -4, i3 -3, i3 -2, i3 -1, i3 0, i3 1, i3 2, i3 3>,
<8 x i3> <i3 -1, i3 -1, i3 -1, i3 -1, i3 -1, i3 -1, i3 -1, i3 -1>,
i32 2)
ret <8 x i3> %r
}
define <8 x i3> @test_smul_fix_v8i3_6() {
; CHECK-LABEL: @test_smul_fix_v8i3_6(
; CHECK-NEXT: ret <8 x i3> <i3 -4, i3 -1, i3 2, i3 -3, i3 0, i3 3, i3 -2, i3 1>
;
%r = call <8 x i3> @llvm.smul.fix.v8i3(
<8 x i3> <i3 -4, i3 -3, i3 -2, i3 -1, i3 0, i3 1, i3 2, i3 3>,
<8 x i3> <i3 3, i3 3, i3 3, i3 3, i3 3, i3 3, i3 3, i3 3>,
i32 0)
ret <8 x i3> %r
}
define <8 x i3> @test_smul_fix_v8i3_7() {
; CHECK-LABEL: @test_smul_fix_v8i3_7(
; CHECK-NEXT: ret <8 x i3> <i3 2, i3 3, i3 -3, i3 -2, i3 0, i3 1, i3 3, i3 -4>
;
%r = call <8 x i3> @llvm.smul.fix.v8i3(
<8 x i3> <i3 -4, i3 -3, i3 -2, i3 -1, i3 0, i3 1, i3 2, i3 3>,
<8 x i3> <i3 3, i3 3, i3 3, i3 3, i3 3, i3 3, i3 3, i3 3>,
i32 1)
ret <8 x i3> %r
}
define <8 x i3> @test_smul_fix_v8i3_8() {
; CHECK-LABEL: @test_smul_fix_v8i3_8(
; CHECK-NEXT: ret <8 x i3> <i3 -3, i3 -3, i3 -2, i3 -1, i3 0, i3 0, i3 1, i3 2>
;
%r = call <8 x i3> @llvm.smul.fix.v8i3(
<8 x i3> <i3 -4, i3 -3, i3 -2, i3 -1, i3 0, i3 1, i3 2, i3 3>,
<8 x i3> <i3 3, i3 3, i3 3, i3 3, i3 3, i3 3, i3 3, i3 3>,
i32 2)
ret <8 x i3> %r
}
define <8 x i3> @test_smul_fix_v8i3_9() {
; CHECK-LABEL: @test_smul_fix_v8i3_9(
; CHECK-NEXT: ret <8 x i3> <i3 0, i3 0, i3 poison, i3 poison, i3 1, i3 1, i3 1, i3 1>
;
%r = call <8 x i3> @llvm.smul.fix.v8i3(
<8 x i3> <i3 2, i3 undef, i3 2, i3 poison, i3 2, i3 2, i3 2, i3 2>,
<8 x i3> <i3 undef, i3 2, i3 poison, i3 2, i3 2, i3 2, i3 2, i3 2>,
i32 2)
ret <8 x i3> %r
}