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
389 lines
11 KiB
LLVM
389 lines
11 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
|
|
|
|
; PR33879 - use shift eflags result when it won't cause stalls
|
|
|
|
; ashr by constant - use sarl eflags result
|
|
define i32 @ashr_const(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: ashr_const:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edx, %eax
|
|
; CHECK-NEXT: sarl $14, %edi
|
|
; CHECK-NEXT: cmovnel %ecx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = ashr i32 %a0, 14
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; lshr by constant - simplify to test
|
|
define i32 @lshr_const(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: lshr_const:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edx, %eax
|
|
; CHECK-NEXT: testl $-16384, %edi # imm = 0xC000
|
|
; CHECK-NEXT: cmovnel %ecx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = lshr i32 %a0, 14
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; shl by constant - simplify to test
|
|
define i32 @shl_const(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: shl_const:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edx, %eax
|
|
; CHECK-NEXT: testl $262143, %edi # imm = 0x3FFFF
|
|
; CHECK-NEXT: cmovnel %ecx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = shl i32 %a0, 14
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; ashr by constant and using shift result - use sarl eflags result
|
|
define i32 @ashr_const_self_select(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: ashr_const_self_select:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: sarl $14, %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = ashr i32 %a0, 14
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; lshr by constant and using shift result - use shrl eflags result
|
|
define i32 @lshr_const_self_select(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: lshr_const_self_select:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: shrl $14, %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = lshr i32 %a0, 14
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; lshr by constant and using result - use shll eflags result
|
|
define i32 @shl_const_self_select(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: shl_const_self_select:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: shll $14, %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = shl i32 %a0, 14
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; ashr by 1 - use sarl eflags result
|
|
define i32 @ashr_const1(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: ashr_const1:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edx, %eax
|
|
; CHECK-NEXT: sarl %edi
|
|
; CHECK-NEXT: cmovnel %ecx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = ashr i32 %a0, 1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; lshr by 1 - simplify to test
|
|
define i32 @lshr_const1(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: lshr_const1:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edx, %eax
|
|
; CHECK-NEXT: testl $-2, %edi
|
|
; CHECK-NEXT: cmovnel %ecx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = lshr i32 %a0, 1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; shl by 1 - simplify to test
|
|
define i32 @shl_const1(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: shl_const1:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edx, %eax
|
|
; CHECK-NEXT: testl $2147483647, %edi # imm = 0x7FFFFFFF
|
|
; CHECK-NEXT: cmovnel %ecx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = shl i32 %a0, 1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; ashr by 1 and using shift result - use sarl eflags result
|
|
define i32 @ashr_const1_self_select(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: ashr_const1_self_select:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: sarl %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = ashr i32 %a0, 1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; lshr by 1 and using shift result - use shrl eflags result
|
|
define i32 @lshr_const1_self_select(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: lshr_const1_self_select:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: shrl %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = lshr i32 %a0, 1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; lshr by 1 and using result - use addl eflags result
|
|
define i32 @shl_const1_self_select(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: shl_const1_self_select:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: addl %edi, %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = shl i32 %a0, 1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; ashr by variable - use separate test
|
|
define i32 @ashr_var(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: ashr_var:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %ecx, %eax
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: sarl %cl, %edi
|
|
; CHECK-NEXT: testl %edi, %edi
|
|
; CHECK-NEXT: cmovel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = ashr i32 %a0, %a1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; lshr by variable - use separate test
|
|
define i32 @lshr_var(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: lshr_var:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %ecx, %eax
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: shrl %cl, %edi
|
|
; CHECK-NEXT: testl %edi, %edi
|
|
; CHECK-NEXT: cmovel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = lshr i32 %a0, %a1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; shl by variable - use separate test
|
|
define i32 @shl_var(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: shl_var:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %ecx, %eax
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: shll %cl, %edi
|
|
; CHECK-NEXT: testl %edi, %edi
|
|
; CHECK-NEXT: cmovel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = shl i32 %a0, %a1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; ashr by variable and using result - use separate test
|
|
define i32 @ashr_var_self_select(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: ashr_var_self_select:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: sarl %cl, %eax
|
|
; CHECK-NEXT: testl %eax, %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = ashr i32 %a0, %a1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; lshr by variable and using result - use separate test
|
|
define i32 @lshr_var_self_select(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: lshr_var_self_select:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: shrl %cl, %eax
|
|
; CHECK-NEXT: testl %eax, %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = lshr i32 %a0, %a1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; shl by variable and using result - use separate test
|
|
define i32 @shl_var_self_select(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: shl_var_self_select:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: shll %cl, %eax
|
|
; CHECK-NEXT: testl %eax, %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%s = shl i32 %a0, %a1
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; ashr by non-zero variable - use separate test
|
|
define i32 @ashr_var_amt_never_zero(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: ashr_var_amt_never_zero:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %ecx, %eax
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: orb $1, %cl
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: sarl %cl, %edi
|
|
; CHECK-NEXT: testl %edi, %edi
|
|
; CHECK-NEXT: cmovel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%a = or i32 %a1, 1
|
|
%s = ashr i32 %a0, %a
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; lshr by non-zero variable - use separate test
|
|
define i32 @lshr_var_amt_never_zero(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: lshr_var_amt_never_zero:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %ecx, %eax
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: orb $1, %cl
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: shrl %cl, %edi
|
|
; CHECK-NEXT: testl %edi, %edi
|
|
; CHECK-NEXT: cmovel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%a = or i32 %a1, 1
|
|
%s = lshr i32 %a0, %a
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; shl by non-zero variable - use separate test
|
|
define i32 @shl_var_amt_never_zero(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: shl_var_amt_never_zero:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %ecx, %eax
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: orb $1, %cl
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: shll %cl, %edi
|
|
; CHECK-NEXT: testl %edi, %edi
|
|
; CHECK-NEXT: cmovel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%a = or i32 %a1, 1
|
|
%s = shl i32 %a0, %a
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %a2, i32 %a3
|
|
ret i32 %r
|
|
}
|
|
|
|
; ashr by non-zero variable and using result - use separate test
|
|
define i32 @ashr_var_self_select_amt_never_zero(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: ashr_var_self_select_amt_never_zero:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: orb $1, %cl
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: shrl %cl, %eax
|
|
; CHECK-NEXT: testl %eax, %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%a = or i32 %a1, 1
|
|
%s = lshr i32 %a0, %a
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; lshr by non-zero variable and using result - use separate test
|
|
define i32 @lshr_var_self_select_amt_never_zero(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: lshr_var_self_select_amt_never_zero:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: orb $1, %cl
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: shrl %cl, %eax
|
|
; CHECK-NEXT: testl %eax, %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%a = or i32 %a1, 1
|
|
%s = lshr i32 %a0, %a
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|
|
|
|
; shl by non-zero variable and using result - use separate test
|
|
define i32 @shl_var_self_select_amt_never_zero(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
|
|
; CHECK-LABEL: shl_var_self_select_amt_never_zero:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %esi, %ecx
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: orb $1, %cl
|
|
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
; CHECK-NEXT: shrl %cl, %eax
|
|
; CHECK-NEXT: testl %eax, %eax
|
|
; CHECK-NEXT: cmovnel %edx, %eax
|
|
; CHECK-NEXT: retq
|
|
%a = or i32 %a1, 1
|
|
%s = lshr i32 %a0, %a
|
|
%c = icmp eq i32 %s, 0
|
|
%r = select i1 %c, i32 %s, i32 %a2
|
|
ret i32 %r
|
|
}
|