Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/X86/apx/imul.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

290 lines
7.8 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,IMM
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs | FileCheck --check-prefix=NF %s
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs | FileCheck --check-prefix=NF %s
define i16 @mul16rr(i16 noundef %a, i16 noundef %b) {
; CHECK-LABEL: mul16rr:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: imull %esi, %edi, %eax
; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq
;
; NF-LABEL: mul16rr:
; NF: # %bb.0: # %entry
; NF-NEXT: {nf} imull %esi, %edi, %eax
; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq
entry:
%mul = mul i16 %a, %b
ret i16 %mul
}
define i32 @mul32rr(i32 noundef %a, i32 noundef %b) {
; CHECK-LABEL: mul32rr:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: imull %esi, %edi, %eax
; CHECK-NEXT: retq
;
; NF-LABEL: mul32rr:
; NF: # %bb.0: # %entry
; NF-NEXT: {nf} imull %esi, %edi, %eax
; NF-NEXT: retq
entry:
%mul = mul i32 %a, %b
ret i32 %mul
}
define i64 @mul64rr(i64 noundef %a, i64 noundef %b) {
; CHECK-LABEL: mul64rr:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: imulq %rsi, %rdi, %rax
; CHECK-NEXT: retq
;
; NF-LABEL: mul64rr:
; NF: # %bb.0: # %entry
; NF-NEXT: {nf} imulq %rsi, %rdi, %rax
; NF-NEXT: retq
entry:
%mul = mul i64 %a, %b
ret i64 %mul
}
define i16 @smul16rr(i16 noundef %a, i16 noundef %b) {
; CHECK-LABEL: smul16rr:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: imulw %si, %di, %ax
; CHECK-NEXT: retq
;
; NF-LABEL: smul16rr:
; NF: # %bb.0: # %entry
; NF-NEXT: {nf} imulw %si, %di, %ax
; NF-NEXT: retq
entry:
%t = call {i16, i1} @llvm.smul.with.overflow.i16(i16 %a, i16 %b)
%mul = extractvalue {i16, i1} %t, 0
ret i16 %mul
}
define i32 @smul32rr(i32 noundef %a, i32 noundef %b) {
; CHECK-LABEL: smul32rr:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: imull %esi, %edi, %eax
; CHECK-NEXT: retq
;
; NF-LABEL: smul32rr:
; NF: # %bb.0: # %entry
; NF-NEXT: {nf} imull %esi, %edi, %eax
; NF-NEXT: retq
entry:
%t = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %a, i32 %b)
%mul = extractvalue {i32, i1} %t, 0
ret i32 %mul
}
define i64 @smul64rr(i64 noundef %a, i64 noundef %b) {
; CHECK-LABEL: smul64rr:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: imulq %rsi, %rdi, %rax
; CHECK-NEXT: retq
;
; NF-LABEL: smul64rr:
; NF: # %bb.0: # %entry
; NF-NEXT: {nf} imulq %rsi, %rdi, %rax
; NF-NEXT: retq
entry:
%t = call {i64, i1} @llvm.smul.with.overflow.i64(i64 %a, i64 %b)
%mul = extractvalue {i64, i1} %t, 0
ret i64 %mul
}
define i16 @mul16rm(i16 noundef %a, ptr %ptr) {
; NDD-LABEL: mul16rm:
; NDD: # %bb.0: # %entry
; NDD-NEXT: movl %edi, %eax
; NDD-NEXT: imulw (%rsi), %ax
; NDD-NEXT: # kill: def $ax killed $ax killed $eax
; NDD-NEXT: retq
;
; IMM-LABEL: mul16rm:
; IMM: # %bb.0: # %entry
; IMM-NEXT: movl %edi, %eax
; IMM-NEXT: imulw (%rsi), %ax
; IMM-NEXT: # kill: def $ax killed $ax killed $eax
; IMM-NEXT: retq
;
; MEM-LABEL: mul16rm:
; MEM: # %bb.0: # %entry
; MEM-NEXT: imulw (%rsi), %di, %ax
; MEM-NEXT: retq
;
; NF-LABEL: mul16rm:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %edi, %eax
; NF-NEXT: imulw (%rsi), %ax
; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq
entry:
%b = load i16, ptr %ptr
%mul = mul i16 %a, %b
ret i16 %mul
}
define i32 @mul32rm(i32 noundef %a, ptr %ptr) {
; NDD-LABEL: mul32rm:
; NDD: # %bb.0: # %entry
; NDD-NEXT: movl %edi, %eax
; NDD-NEXT: imull (%rsi), %eax
; NDD-NEXT: retq
;
; IMM-LABEL: mul32rm:
; IMM: # %bb.0: # %entry
; IMM-NEXT: movl %edi, %eax
; IMM-NEXT: imull (%rsi), %eax
; IMM-NEXT: retq
;
; MEM-LABEL: mul32rm:
; MEM: # %bb.0: # %entry
; MEM-NEXT: imull (%rsi), %edi, %eax
; MEM-NEXT: retq
;
; NF-LABEL: mul32rm:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %edi, %eax
; NF-NEXT: imull (%rsi), %eax
; NF-NEXT: retq
entry:
%b = load i32, ptr %ptr
%mul = mul i32 %a, %b
ret i32 %mul
}
define i64 @mul64rm(i64 noundef %a, ptr %ptr) {
; NDD-LABEL: mul64rm:
; NDD: # %bb.0: # %entry
; NDD-NEXT: movq %rdi, %rax
; NDD-NEXT: imulq (%rsi), %rax
; NDD-NEXT: retq
;
; IMM-LABEL: mul64rm:
; IMM: # %bb.0: # %entry
; IMM-NEXT: movq %rdi, %rax
; IMM-NEXT: imulq (%rsi), %rax
; IMM-NEXT: retq
;
; MEM-LABEL: mul64rm:
; MEM: # %bb.0: # %entry
; MEM-NEXT: imulq (%rsi), %rdi, %rax
; MEM-NEXT: retq
;
; NF-LABEL: mul64rm:
; NF: # %bb.0: # %entry
; NF-NEXT: movq %rdi, %rax
; NF-NEXT: imulq (%rsi), %rax
; NF-NEXT: retq
entry:
%b = load i64, ptr %ptr
%mul = mul i64 %a, %b
ret i64 %mul
}
define i16 @smul16rm(i16 noundef %a, ptr %ptr) {
; NDD-LABEL: smul16rm:
; NDD: # %bb.0: # %entry
; NDD-NEXT: movl %edi, %eax
; NDD-NEXT: imulw (%rsi), %ax
; NDD-NEXT: # kill: def $ax killed $ax killed $eax
; NDD-NEXT: retq
;
; IMM-LABEL: smul16rm:
; IMM: # %bb.0: # %entry
; IMM-NEXT: movl %edi, %eax
; IMM-NEXT: imulw (%rsi), %ax
; IMM-NEXT: # kill: def $ax killed $ax killed $eax
; IMM-NEXT: retq
;
; MEM-LABEL: smul16rm:
; MEM: # %bb.0: # %entry
; MEM-NEXT: imulw (%rsi), %di, %ax
; MEM-NEXT: retq
;
; NF-LABEL: smul16rm:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %edi, %eax
; NF-NEXT: imulw (%rsi), %ax
; NF-NEXT: # kill: def $ax killed $ax killed $eax
; NF-NEXT: retq
entry:
%b = load i16, ptr %ptr
%t = call {i16, i1} @llvm.smul.with.overflow.i16(i16 %a, i16 %b)
%mul = extractvalue {i16, i1} %t, 0
ret i16 %mul
}
define i32 @smul32rm(i32 noundef %a, ptr %ptr) {
; NDD-LABEL: smul32rm:
; NDD: # %bb.0: # %entry
; NDD-NEXT: movl %edi, %eax
; NDD-NEXT: imull (%rsi), %eax
; NDD-NEXT: retq
;
; IMM-LABEL: smul32rm:
; IMM: # %bb.0: # %entry
; IMM-NEXT: movl %edi, %eax
; IMM-NEXT: imull (%rsi), %eax
; IMM-NEXT: retq
;
; MEM-LABEL: smul32rm:
; MEM: # %bb.0: # %entry
; MEM-NEXT: imull (%rsi), %edi, %eax
; MEM-NEXT: retq
;
; NF-LABEL: smul32rm:
; NF: # %bb.0: # %entry
; NF-NEXT: movl %edi, %eax
; NF-NEXT: imull (%rsi), %eax
; NF-NEXT: retq
entry:
%b = load i32, ptr %ptr
%t = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %a, i32 %b)
%mul = extractvalue {i32, i1} %t, 0
ret i32 %mul
}
define i64 @smul64rm(i64 noundef %a, ptr %ptr) {
; NDD-LABEL: smul64rm:
; NDD: # %bb.0: # %entry
; NDD-NEXT: movq %rdi, %rax
; NDD-NEXT: imulq (%rsi), %rax
; NDD-NEXT: retq
;
; IMM-LABEL: smul64rm:
; IMM: # %bb.0: # %entry
; IMM-NEXT: movq %rdi, %rax
; IMM-NEXT: imulq (%rsi), %rax
; IMM-NEXT: retq
;
; MEM-LABEL: smul64rm:
; MEM: # %bb.0: # %entry
; MEM-NEXT: imulq (%rsi), %rdi, %rax
; MEM-NEXT: retq
;
; NF-LABEL: smul64rm:
; NF: # %bb.0: # %entry
; NF-NEXT: movq %rdi, %rax
; NF-NEXT: imulq (%rsi), %rax
; NF-NEXT: retq
entry:
%b = load i64, ptr %ptr
%t = call {i64, i1} @llvm.smul.with.overflow.i64(i64 %a, i64 %b)
%mul = extractvalue {i64, i1} %t, 0
ret i64 %mul
}
declare { i16, i1 } @llvm.smul.with.overflow.i16(i16, i16) nounwind readnone
declare { i32, i1 } @llvm.smul.with.overflow.i32(i32, i32) nounwind readnone
declare { i64, i1 } @llvm.smul.with.overflow.i64(i64, i64) nounwind readnone