Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/RISCV/bitextract-mac.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

135 lines
4.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -mattr=+m -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV32I
; RUN: llc -mtriple=riscv32 -mattr=+zbb -mattr=+m -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV32ZBB
; RUN: llc -mtriple=riscv32 -mattr=+xtheadbb -mattr=+m -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV32XTHEADBB
; RUN: llc -mtriple=riscv32 -mattr=+xtheadmac -mattr=+m -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV32XTHEADMAC
; RUN: llc -mtriple=riscv32 -mattr=+xtheadmac -mattr=+xtheadbb -mattr=+m -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV32XTHEAD
; RUN: llc -mtriple=riscv64 -mattr=+m -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV64I
; RUN: llc -mtriple=riscv64 -mattr=+zbb -mattr=+m -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV64ZBB
; RUN: llc -mtriple=riscv64 -mattr=+xtheadmac -mattr=+m -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV64XTHEADMAC
; RUN: llc -mtriple=riscv64 -mattr=+xtheadbb -mattr=+m -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV64XTHEADBB
; RUN: llc -mtriple=riscv64 -mattr=+xtheadmac -mattr=+xtheadbb -mattr=+m -verify-machineinstrs < %s \
; RUN: | FileCheck %s -check-prefix=RV64XTHEAD
define i32 @f(i32 %A, i32 %B, i32 %C) {
; RV32I-LABEL: f:
; RV32I: # %bb.0: # %entry
; RV32I-NEXT: mul a0, a1, a0
; RV32I-NEXT: slli a1, a0, 26
; RV32I-NEXT: slli a0, a0, 20
; RV32I-NEXT: srli a1, a1, 28
; RV32I-NEXT: srli a0, a0, 25
; RV32I-NEXT: mul a0, a1, a0
; RV32I-NEXT: add a0, a0, a2
; RV32I-NEXT: ret
;
; RV32ZBB-LABEL: f:
; RV32ZBB: # %bb.0: # %entry
; RV32ZBB-NEXT: mul a0, a1, a0
; RV32ZBB-NEXT: slli a1, a0, 26
; RV32ZBB-NEXT: slli a0, a0, 20
; RV32ZBB-NEXT: srli a1, a1, 28
; RV32ZBB-NEXT: srli a0, a0, 25
; RV32ZBB-NEXT: mul a0, a1, a0
; RV32ZBB-NEXT: add a0, a0, a2
; RV32ZBB-NEXT: ret
;
; RV32XTHEADBB-LABEL: f:
; RV32XTHEADBB: # %bb.0: # %entry
; RV32XTHEADBB-NEXT: mul a0, a1, a0
; RV32XTHEADBB-NEXT: th.extu a1, a0, 5, 2
; RV32XTHEADBB-NEXT: th.extu a0, a0, 11, 5
; RV32XTHEADBB-NEXT: mul a0, a1, a0
; RV32XTHEADBB-NEXT: add a0, a0, a2
; RV32XTHEADBB-NEXT: ret
;
; RV32XTHEADMAC-LABEL: f:
; RV32XTHEADMAC: # %bb.0: # %entry
; RV32XTHEADMAC-NEXT: mul a0, a1, a0
; RV32XTHEADMAC-NEXT: slli a1, a0, 26
; RV32XTHEADMAC-NEXT: slli a0, a0, 20
; RV32XTHEADMAC-NEXT: srli a1, a1, 28
; RV32XTHEADMAC-NEXT: srli a0, a0, 25
; RV32XTHEADMAC-NEXT: th.mulah a2, a1, a0
; RV32XTHEADMAC-NEXT: mv a0, a2
; RV32XTHEADMAC-NEXT: ret
;
; RV32XTHEAD-LABEL: f:
; RV32XTHEAD: # %bb.0: # %entry
; RV32XTHEAD-NEXT: mul a0, a1, a0
; RV32XTHEAD-NEXT: th.extu a1, a0, 5, 2
; RV32XTHEAD-NEXT: th.extu a0, a0, 11, 5
; RV32XTHEAD-NEXT: th.mulah a2, a1, a0
; RV32XTHEAD-NEXT: mv a0, a2
; RV32XTHEAD-NEXT: ret
;
; RV64I-LABEL: f:
; RV64I: # %bb.0: # %entry
; RV64I-NEXT: mul a0, a1, a0
; RV64I-NEXT: slli a1, a0, 58
; RV64I-NEXT: slli a0, a0, 52
; RV64I-NEXT: srli a1, a1, 60
; RV64I-NEXT: srli a0, a0, 57
; RV64I-NEXT: mul a0, a1, a0
; RV64I-NEXT: addw a0, a0, a2
; RV64I-NEXT: ret
;
; RV64ZBB-LABEL: f:
; RV64ZBB: # %bb.0: # %entry
; RV64ZBB-NEXT: mul a0, a1, a0
; RV64ZBB-NEXT: slli a1, a0, 58
; RV64ZBB-NEXT: slli a0, a0, 52
; RV64ZBB-NEXT: srli a1, a1, 60
; RV64ZBB-NEXT: srli a0, a0, 57
; RV64ZBB-NEXT: mul a0, a1, a0
; RV64ZBB-NEXT: addw a0, a0, a2
; RV64ZBB-NEXT: ret
;
; RV64XTHEADMAC-LABEL: f:
; RV64XTHEADMAC: # %bb.0: # %entry
; RV64XTHEADMAC-NEXT: mul a0, a1, a0
; RV64XTHEADMAC-NEXT: slli a1, a0, 58
; RV64XTHEADMAC-NEXT: slli a0, a0, 52
; RV64XTHEADMAC-NEXT: srli a1, a1, 60
; RV64XTHEADMAC-NEXT: srli a0, a0, 57
; RV64XTHEADMAC-NEXT: th.mulah a2, a1, a0
; RV64XTHEADMAC-NEXT: mv a0, a2
; RV64XTHEADMAC-NEXT: ret
;
; RV64XTHEADBB-LABEL: f:
; RV64XTHEADBB: # %bb.0: # %entry
; RV64XTHEADBB-NEXT: mul a0, a1, a0
; RV64XTHEADBB-NEXT: th.extu a1, a0, 5, 2
; RV64XTHEADBB-NEXT: th.extu a0, a0, 11, 5
; RV64XTHEADBB-NEXT: mul a0, a1, a0
; RV64XTHEADBB-NEXT: addw a0, a0, a2
; RV64XTHEADBB-NEXT: ret
;
; RV64XTHEAD-LABEL: f:
; RV64XTHEAD: # %bb.0: # %entry
; RV64XTHEAD-NEXT: mul a0, a1, a0
; RV64XTHEAD-NEXT: th.extu a1, a0, 5, 2
; RV64XTHEAD-NEXT: th.extu a0, a0, 11, 5
; RV64XTHEAD-NEXT: th.mulah a2, a1, a0
; RV64XTHEAD-NEXT: mv a0, a2
; RV64XTHEAD-NEXT: ret
entry:
%mul = mul nsw i32 %B, %A
%0 = lshr i32 %mul, 2
%and = and i32 %0, 15
%1 = lshr i32 %mul, 5
%and2 = and i32 %1, 127
%mul3 = mul nuw nsw i32 %and, %and2
%add = add i32 %mul3, %C
ret i32 %add
}