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
99 lines
2.7 KiB
LLVM
99 lines
2.7 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=CHECK
|
|
|
|
define i32 @fold_urem_positive_odd(i32 %x) {
|
|
; CHECK-LABEL: fold_urem_positive_odd:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: movabsq $194176253438197760, %rcx # imm = 0x2B1DA4612000000
|
|
; CHECK-NEXT: mulq %rcx
|
|
; CHECK-NEXT: imull $95, %edx, %eax
|
|
; CHECK-NEXT: subl %eax, %edi
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: retq
|
|
%1 = urem i32 %x, 95
|
|
ret i32 %1
|
|
}
|
|
|
|
|
|
define i32 @fold_urem_positive_even(i32 %x) {
|
|
; CHECK-LABEL: fold_urem_positive_even:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: movl %edi, %ecx
|
|
; CHECK-NEXT: movl $4149100483, %edx # imm = 0xF74E3FC3
|
|
; CHECK-NEXT: imulq %rcx, %rdx
|
|
; CHECK-NEXT: shrq $42, %rdx
|
|
; CHECK-NEXT: imull $1060, %edx, %ecx # imm = 0x424
|
|
; CHECK-NEXT: subl %ecx, %eax
|
|
; CHECK-NEXT: retq
|
|
%1 = urem i32 %x, 1060
|
|
ret i32 %1
|
|
}
|
|
|
|
|
|
; Don't fold if we can combine urem with udiv.
|
|
define i32 @combine_urem_udiv(i32 %x) {
|
|
; CHECK-LABEL: combine_urem_udiv:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: movabsq $194176253438197760, %rcx # imm = 0x2B1DA4612000000
|
|
; CHECK-NEXT: mulq %rcx
|
|
; CHECK-NEXT: imull $95, %edx, %eax
|
|
; CHECK-NEXT: subl %eax, %edi
|
|
; CHECK-NEXT: leal (%rdi,%rdx), %eax
|
|
; CHECK-NEXT: retq
|
|
%1 = urem i32 %x, 95
|
|
%2 = udiv i32 %x, 95
|
|
%3 = add i32 %1, %2
|
|
ret i32 %3
|
|
}
|
|
|
|
; Don't fold for divisors that are a power of two.
|
|
define i32 @dont_fold_urem_power_of_two(i32 %x) {
|
|
; CHECK-LABEL: dont_fold_urem_power_of_two:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movl %edi, %eax
|
|
; CHECK-NEXT: andl $63, %eax
|
|
; CHECK-NEXT: retq
|
|
%1 = urem i32 %x, 64
|
|
ret i32 %1
|
|
}
|
|
|
|
; Don't fold if the divisor is one.
|
|
define i32 @dont_fold_urem_one(i32 %x) {
|
|
; CHECK-LABEL: dont_fold_urem_one:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: xorl %eax, %eax
|
|
; CHECK-NEXT: retq
|
|
%1 = urem i32 %x, 1
|
|
ret i32 %1
|
|
}
|
|
|
|
; Don't fold if the divisor is 2^32.
|
|
define i32 @dont_fold_urem_i32_umax(i32 %x) {
|
|
; CHECK-LABEL: dont_fold_urem_i32_umax:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: retq
|
|
%1 = urem i32 %x, 4294967296
|
|
ret i32 %1
|
|
}
|
|
|
|
; Don't fold i64 urem
|
|
define i64 @dont_fold_urem_i64(i64 %x) {
|
|
; CHECK-LABEL: dont_fold_urem_i64:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movq %rdi, %rax
|
|
; CHECK-NEXT: shrq %rax
|
|
; CHECK-NEXT: movabsq $6023426636313322977, %rcx # imm = 0x5397829CBC14E5E1
|
|
; CHECK-NEXT: mulq %rcx
|
|
; CHECK-NEXT: shrq $4, %rdx
|
|
; CHECK-NEXT: imulq $98, %rdx, %rax
|
|
; CHECK-NEXT: subq %rax, %rdi
|
|
; CHECK-NEXT: movq %rdi, %rax
|
|
; CHECK-NEXT: retq
|
|
%1 = urem i64 %x, 98
|
|
ret i64 %1
|
|
}
|