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

459 lines
10 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
define i32 @add_undef_rhs(i32 %x) {
; CHECK-LABEL: add_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = add i32 %x, undef
ret i32 %r
}
define <4 x i32> @add_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: add_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = add <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @add_undef_lhs(i32 %x) {
; CHECK-LABEL: add_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = add i32 undef, %x
ret i32 %r
}
define <4 x i32> @add_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: add_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = add <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @sub_undef_rhs(i32 %x) {
; CHECK-LABEL: sub_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = sub i32 %x, undef
ret i32 %r
}
define <4 x i32> @sub_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: sub_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = sub <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @sub_undef_lhs(i32 %x) {
; CHECK-LABEL: sub_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = sub i32 undef, %x
ret i32 %r
}
define <4 x i32> @sub_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: sub_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = sub <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @mul_undef_rhs(i32 %x) {
; CHECK-LABEL: mul_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = mul i32 %x, undef
ret i32 %r
}
define <4 x i32> @mul_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: mul_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = mul <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @mul_undef_lhs(i32 %x) {
; CHECK-LABEL: mul_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = mul i32 undef, %x
ret i32 %r
}
define <4 x i32> @mul_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: mul_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = mul <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @sdiv_undef_rhs(i32 %x) {
; CHECK-LABEL: sdiv_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = sdiv i32 %x, undef
ret i32 %r
}
define <4 x i32> @sdiv_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: sdiv_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = sdiv <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @sdiv_undef_lhs(i32 %x) {
; CHECK-LABEL: sdiv_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = sdiv i32 undef, %x
ret i32 %r
}
define <4 x i32> @sdiv_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: sdiv_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = sdiv <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @udiv_undef_rhs(i32 %x) {
; CHECK-LABEL: udiv_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = udiv i32 %x, undef
ret i32 %r
}
define <4 x i32> @udiv_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: udiv_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = udiv <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @udiv_undef_lhs(i32 %x) {
; CHECK-LABEL: udiv_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = udiv i32 undef, %x
ret i32 %r
}
define <4 x i32> @udiv_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: udiv_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = udiv <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @srem_undef_rhs(i32 %x) {
; CHECK-LABEL: srem_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = srem i32 %x, undef
ret i32 %r
}
define <4 x i32> @srem_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: srem_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = srem <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @srem_undef_lhs(i32 %x) {
; CHECK-LABEL: srem_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = srem i32 undef, %x
ret i32 %r
}
define <4 x i32> @srem_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: srem_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = srem <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @urem_undef_rhs(i32 %x) {
; CHECK-LABEL: urem_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = urem i32 %x, undef
ret i32 %r
}
define <4 x i32> @urem_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: urem_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = urem <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @urem_undef_lhs(i32 %x) {
; CHECK-LABEL: urem_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = urem i32 undef, %x
ret i32 %r
}
define <4 x i32> @urem_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: urem_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = urem <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @ashr_undef_rhs(i32 %x) {
; CHECK-LABEL: ashr_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = ashr i32 %x, undef
ret i32 %r
}
define <4 x i32> @ashr_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: ashr_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = ashr <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @ashr_undef_lhs(i32 %x) {
; CHECK-LABEL: ashr_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = ashr i32 undef, %x
ret i32 %r
}
define <4 x i32> @ashr_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: ashr_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = ashr <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @lshr_undef_rhs(i32 %x) {
; CHECK-LABEL: lshr_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = lshr i32 %x, undef
ret i32 %r
}
define <4 x i32> @lshr_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: lshr_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = lshr <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @lshr_undef_lhs(i32 %x) {
; CHECK-LABEL: lshr_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = lshr i32 undef, %x
ret i32 %r
}
define <4 x i32> @lshr_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: lshr_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = lshr <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @shl_undef_rhs(i32 %x) {
; CHECK-LABEL: shl_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = shl i32 %x, undef
ret i32 %r
}
define <4 x i32> @shl_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: shl_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = shl <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @shl_undef_lhs(i32 %x) {
; CHECK-LABEL: shl_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = shl i32 undef, %x
ret i32 %r
}
define <4 x i32> @shl_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: shl_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = shl <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @and_undef_rhs(i32 %x) {
; CHECK-LABEL: and_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = and i32 %x, undef
ret i32 %r
}
define <4 x i32> @and_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: and_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = and <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @and_undef_lhs(i32 %x) {
; CHECK-LABEL: and_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%r = and i32 undef, %x
ret i32 %r
}
define <4 x i32> @and_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: and_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: xorps %xmm0, %xmm0
; CHECK-NEXT: retq
%r = and <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @or_undef_rhs(i32 %x) {
; CHECK-LABEL: or_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: movl $-1, %eax
; CHECK-NEXT: retq
%r = or i32 %x, undef
ret i32 %r
}
define <4 x i32> @or_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: or_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: pcmpeqd %xmm0, %xmm0
; CHECK-NEXT: retq
%r = or <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @or_undef_lhs(i32 %x) {
; CHECK-LABEL: or_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: movl $-1, %eax
; CHECK-NEXT: retq
%r = or i32 undef, %x
ret i32 %r
}
define <4 x i32> @or_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: or_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: pcmpeqd %xmm0, %xmm0
; CHECK-NEXT: retq
%r = or <4 x i32> undef, %x
ret <4 x i32> %r
}
define i32 @xor_undef_rhs(i32 %x) {
; CHECK-LABEL: xor_undef_rhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = xor i32 %x, undef
ret i32 %r
}
define <4 x i32> @xor_undef_rhs_vec(<4 x i32> %x) {
; CHECK-LABEL: xor_undef_rhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = xor <4 x i32> %x, undef
ret <4 x i32> %r
}
define i32 @xor_undef_lhs(i32 %x) {
; CHECK-LABEL: xor_undef_lhs:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = xor i32 undef, %x
ret i32 %r
}
define <4 x i32> @xor_undef_lhs_vec(<4 x i32> %x) {
; CHECK-LABEL: xor_undef_lhs_vec:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%r = xor <4 x i32> undef, %x
ret <4 x i32> %r
}
; This would crash because the shift amount is an i8 operand,
; but the result of the shift is i32. We can't just propagate
; the existing undef as the result.
define i1 @undef_operand_size_not_same_as_result() {
; CHECK-LABEL: undef_operand_size_not_same_as_result:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
%sh = shl i32 7, undef
%cmp = icmp eq i32 0, %sh
ret i1 %cmp
}