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
344 lines
10 KiB
LLVM
344 lines
10 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+bmi < %s | FileCheck %s --check-prefixes=X64,X64-BMI
|
|
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=-bmi < %s | FileCheck %s --check-prefixes=X64,X64-NOBMI
|
|
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=+bmi,+cmov < %s | FileCheck %s --check-prefixes=X86,X86-BMI
|
|
; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=-bmi < %s | FileCheck %s --check-prefixes=X86,X86-NOBMI
|
|
|
|
declare i8 @llvm.smax.i8(i8, i8)
|
|
declare i8 @llvm.smin.i8(i8, i8)
|
|
declare i16 @llvm.smax.i16(i16, i16)
|
|
declare i16 @llvm.smin.i16(i16, i16)
|
|
declare i32 @llvm.smax.i32(i32, i32)
|
|
declare i32 @llvm.smin.i32(i32, i32)
|
|
declare i64 @llvm.smax.i64(i64, i64)
|
|
declare i64 @llvm.smin.i64(i64, i64)
|
|
declare i128 @llvm.smax.i128(i128, i128)
|
|
declare i128 @llvm.smin.i128(i128, i128)
|
|
|
|
define i8 @test_i8_smax(i8 %a) nounwind {
|
|
; X64-LABEL: test_i8_smax:
|
|
; X64: # %bb.0:
|
|
; X64-NEXT: xorl %eax, %eax
|
|
; X64-NEXT: testb %dil, %dil
|
|
; X64-NEXT: cmovgl %edi, %eax
|
|
; X64-NEXT: # kill: def $al killed $al killed $eax
|
|
; X64-NEXT: retq
|
|
;
|
|
; X86-BMI-LABEL: test_i8_smax:
|
|
; X86-BMI: # %bb.0:
|
|
; X86-BMI-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
; X86-BMI-NEXT: xorl %eax, %eax
|
|
; X86-BMI-NEXT: testb %cl, %cl
|
|
; X86-BMI-NEXT: cmovgl %ecx, %eax
|
|
; X86-BMI-NEXT: # kill: def $al killed $al killed $eax
|
|
; X86-BMI-NEXT: retl
|
|
;
|
|
; X86-NOBMI-LABEL: test_i8_smax:
|
|
; X86-NOBMI: # %bb.0:
|
|
; X86-NOBMI-NEXT: movzbl {{[0-9]+}}(%esp), %eax
|
|
; X86-NOBMI-NEXT: testb %al, %al
|
|
; X86-NOBMI-NEXT: jg .LBB0_2
|
|
; X86-NOBMI-NEXT: # %bb.1:
|
|
; X86-NOBMI-NEXT: xorl %eax, %eax
|
|
; X86-NOBMI-NEXT: .LBB0_2:
|
|
; X86-NOBMI-NEXT: # kill: def $al killed $al killed $eax
|
|
; X86-NOBMI-NEXT: retl
|
|
%r = call i8 @llvm.smax.i8(i8 %a, i8 0)
|
|
ret i8 %r
|
|
}
|
|
|
|
define i8 @test_i8_smin(i8 %a) nounwind {
|
|
; X64-LABEL: test_i8_smin:
|
|
; X64: # %bb.0:
|
|
; X64-NEXT: movl %edi, %eax
|
|
; X64-NEXT: sarb $7, %al
|
|
; X64-NEXT: andb %dil, %al
|
|
; X64-NEXT: retq
|
|
;
|
|
; X86-LABEL: test_i8_smin:
|
|
; X86: # %bb.0:
|
|
; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
|
|
; X86-NEXT: movl %ecx, %eax
|
|
; X86-NEXT: sarb $7, %al
|
|
; X86-NEXT: andb %cl, %al
|
|
; X86-NEXT: retl
|
|
%r = call i8 @llvm.smin.i8(i8 %a, i8 0)
|
|
ret i8 %r
|
|
}
|
|
|
|
define i16 @test_i16_smax(i16 %a) nounwind {
|
|
; X64-LABEL: test_i16_smax:
|
|
; X64: # %bb.0:
|
|
; X64-NEXT: xorl %eax, %eax
|
|
; X64-NEXT: testw %di, %di
|
|
; X64-NEXT: cmovgl %edi, %eax
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
|
; X64-NEXT: retq
|
|
;
|
|
; X86-BMI-LABEL: test_i16_smax:
|
|
; X86-BMI: # %bb.0:
|
|
; X86-BMI-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
; X86-BMI-NEXT: xorl %eax, %eax
|
|
; X86-BMI-NEXT: testw %cx, %cx
|
|
; X86-BMI-NEXT: cmovgl %ecx, %eax
|
|
; X86-BMI-NEXT: # kill: def $ax killed $ax killed $eax
|
|
; X86-BMI-NEXT: retl
|
|
;
|
|
; X86-NOBMI-LABEL: test_i16_smax:
|
|
; X86-NOBMI: # %bb.0:
|
|
; X86-NOBMI-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
; X86-NOBMI-NEXT: testw %ax, %ax
|
|
; X86-NOBMI-NEXT: jg .LBB2_2
|
|
; X86-NOBMI-NEXT: # %bb.1:
|
|
; X86-NOBMI-NEXT: xorl %eax, %eax
|
|
; X86-NOBMI-NEXT: .LBB2_2:
|
|
; X86-NOBMI-NEXT: # kill: def $ax killed $ax killed $eax
|
|
; X86-NOBMI-NEXT: retl
|
|
%r = call i16 @llvm.smax.i16(i16 %a, i16 0)
|
|
ret i16 %r
|
|
}
|
|
|
|
define i16 @test_i16_smin(i16 %a) nounwind {
|
|
; X64-LABEL: test_i16_smin:
|
|
; X64: # %bb.0:
|
|
; X64-NEXT: movswl %di, %eax
|
|
; X64-NEXT: sarl $15, %eax
|
|
; X64-NEXT: andl %edi, %eax
|
|
; X64-NEXT: # kill: def $ax killed $ax killed $eax
|
|
; X64-NEXT: retq
|
|
;
|
|
; X86-LABEL: test_i16_smin:
|
|
; X86: # %bb.0:
|
|
; X86-NEXT: movswl {{[0-9]+}}(%esp), %ecx
|
|
; X86-NEXT: movl %ecx, %eax
|
|
; X86-NEXT: shrl $15, %eax
|
|
; X86-NEXT: andl %ecx, %eax
|
|
; X86-NEXT: # kill: def $ax killed $ax killed $eax
|
|
; X86-NEXT: retl
|
|
%r = call i16 @llvm.smin.i16(i16 %a, i16 0)
|
|
ret i16 %r
|
|
}
|
|
|
|
define i32 @test_i32_smax(i32 %a) nounwind {
|
|
; X64-BMI-LABEL: test_i32_smax:
|
|
; X64-BMI: # %bb.0:
|
|
; X64-BMI-NEXT: movl %edi, %eax
|
|
; X64-BMI-NEXT: sarl $31, %eax
|
|
; X64-BMI-NEXT: andnl %edi, %eax, %eax
|
|
; X64-BMI-NEXT: retq
|
|
;
|
|
; X64-NOBMI-LABEL: test_i32_smax:
|
|
; X64-NOBMI: # %bb.0:
|
|
; X64-NOBMI-NEXT: xorl %eax, %eax
|
|
; X64-NOBMI-NEXT: testl %edi, %edi
|
|
; X64-NOBMI-NEXT: cmovgl %edi, %eax
|
|
; X64-NOBMI-NEXT: retq
|
|
;
|
|
; X86-BMI-LABEL: test_i32_smax:
|
|
; X86-BMI: # %bb.0:
|
|
; X86-BMI-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
; X86-BMI-NEXT: movl %eax, %ecx
|
|
; X86-BMI-NEXT: sarl $31, %ecx
|
|
; X86-BMI-NEXT: andnl %eax, %ecx, %eax
|
|
; X86-BMI-NEXT: retl
|
|
;
|
|
; X86-NOBMI-LABEL: test_i32_smax:
|
|
; X86-NOBMI: # %bb.0:
|
|
; X86-NOBMI-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
; X86-NOBMI-NEXT: testl %eax, %eax
|
|
; X86-NOBMI-NEXT: jg .LBB4_2
|
|
; X86-NOBMI-NEXT: # %bb.1:
|
|
; X86-NOBMI-NEXT: xorl %eax, %eax
|
|
; X86-NOBMI-NEXT: .LBB4_2:
|
|
; X86-NOBMI-NEXT: retl
|
|
%r = call i32 @llvm.smax.i32(i32 %a, i32 0)
|
|
ret i32 %r
|
|
}
|
|
|
|
define i32 @test_i32_smin(i32 %a) nounwind {
|
|
; X64-LABEL: test_i32_smin:
|
|
; X64: # %bb.0:
|
|
; X64-NEXT: movl %edi, %eax
|
|
; X64-NEXT: sarl $31, %eax
|
|
; X64-NEXT: andl %edi, %eax
|
|
; X64-NEXT: retq
|
|
;
|
|
; X86-LABEL: test_i32_smin:
|
|
; X86: # %bb.0:
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
; X86-NEXT: movl %ecx, %eax
|
|
; X86-NEXT: sarl $31, %eax
|
|
; X86-NEXT: andl %ecx, %eax
|
|
; X86-NEXT: retl
|
|
%r = call i32 @llvm.smin.i32(i32 %a, i32 0)
|
|
ret i32 %r
|
|
}
|
|
|
|
define i64 @test_i64_smax(i64 %a) nounwind {
|
|
; X64-BMI-LABEL: test_i64_smax:
|
|
; X64-BMI: # %bb.0:
|
|
; X64-BMI-NEXT: movq %rdi, %rax
|
|
; X64-BMI-NEXT: sarq $63, %rax
|
|
; X64-BMI-NEXT: andnq %rdi, %rax, %rax
|
|
; X64-BMI-NEXT: retq
|
|
;
|
|
; X64-NOBMI-LABEL: test_i64_smax:
|
|
; X64-NOBMI: # %bb.0:
|
|
; X64-NOBMI-NEXT: xorl %eax, %eax
|
|
; X64-NOBMI-NEXT: testq %rdi, %rdi
|
|
; X64-NOBMI-NEXT: cmovgq %rdi, %rax
|
|
; X64-NOBMI-NEXT: retq
|
|
;
|
|
; X86-BMI-LABEL: test_i64_smax:
|
|
; X86-BMI: # %bb.0:
|
|
; X86-BMI-NEXT: movl {{[0-9]+}}(%esp), %edx
|
|
; X86-BMI-NEXT: xorl %eax, %eax
|
|
; X86-BMI-NEXT: testl %edx, %edx
|
|
; X86-BMI-NEXT: cmovlel %eax, %edx
|
|
; X86-BMI-NEXT: cmovnsl {{[0-9]+}}(%esp), %eax
|
|
; X86-BMI-NEXT: retl
|
|
;
|
|
; X86-NOBMI-LABEL: test_i64_smax:
|
|
; X86-NOBMI: # %bb.0:
|
|
; X86-NOBMI-NEXT: movl {{[0-9]+}}(%esp), %edx
|
|
; X86-NOBMI-NEXT: testl %edx, %edx
|
|
; X86-NOBMI-NEXT: movl $0, %eax
|
|
; X86-NOBMI-NEXT: jns .LBB6_1
|
|
; X86-NOBMI-NEXT: # %bb.2:
|
|
; X86-NOBMI-NEXT: jle .LBB6_3
|
|
; X86-NOBMI-NEXT: .LBB6_4:
|
|
; X86-NOBMI-NEXT: retl
|
|
; X86-NOBMI-NEXT: .LBB6_1:
|
|
; X86-NOBMI-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
; X86-NOBMI-NEXT: jg .LBB6_4
|
|
; X86-NOBMI-NEXT: .LBB6_3:
|
|
; X86-NOBMI-NEXT: xorl %edx, %edx
|
|
; X86-NOBMI-NEXT: retl
|
|
%r = call i64 @llvm.smax.i64(i64 %a, i64 0)
|
|
ret i64 %r
|
|
}
|
|
|
|
define i64 @test_i64_smin(i64 %a) nounwind {
|
|
; X64-LABEL: test_i64_smin:
|
|
; X64: # %bb.0:
|
|
; X64-NEXT: movq %rdi, %rax
|
|
; X64-NEXT: sarq $63, %rax
|
|
; X64-NEXT: andq %rdi, %rax
|
|
; X64-NEXT: retq
|
|
;
|
|
; X86-LABEL: test_i64_smin:
|
|
; X86: # %bb.0:
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
|
|
; X86-NEXT: movl %edx, %eax
|
|
; X86-NEXT: sarl $31, %eax
|
|
; X86-NEXT: andl %eax, %edx
|
|
; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
|
|
; X86-NEXT: retl
|
|
%r = call i64 @llvm.smin.i64(i64 %a, i64 0)
|
|
ret i64 %r
|
|
}
|
|
|
|
define i128 @test_i128_smax(i128 %a) nounwind {
|
|
; X64-LABEL: test_i128_smax:
|
|
; X64: # %bb.0:
|
|
; X64-NEXT: movq %rdi, %rax
|
|
; X64-NEXT: xorl %edx, %edx
|
|
; X64-NEXT: testq %rsi, %rsi
|
|
; X64-NEXT: cmovsq %rdx, %rax
|
|
; X64-NEXT: cmovgq %rsi, %rdx
|
|
; X64-NEXT: retq
|
|
;
|
|
; X86-BMI-LABEL: test_i128_smax:
|
|
; X86-BMI: # %bb.0:
|
|
; X86-BMI-NEXT: pushl %edi
|
|
; X86-BMI-NEXT: pushl %esi
|
|
; X86-BMI-NEXT: pushl %eax
|
|
; X86-BMI-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
; X86-BMI-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
; X86-BMI-NEXT: xorl %edx, %edx
|
|
; X86-BMI-NEXT: testl %ecx, %ecx
|
|
; X86-BMI-NEXT: cmovlel %edx, %ecx
|
|
; X86-BMI-NEXT: movl {{[0-9]+}}(%esp), %esi
|
|
; X86-BMI-NEXT: cmovsl %edx, %esi
|
|
; X86-BMI-NEXT: movl {{[0-9]+}}(%esp), %edi
|
|
; X86-BMI-NEXT: cmovsl %edx, %edi
|
|
; X86-BMI-NEXT: cmovnsl {{[0-9]+}}(%esp), %edx
|
|
; X86-BMI-NEXT: movl %ecx, 12(%eax)
|
|
; X86-BMI-NEXT: movl %edx, 8(%eax)
|
|
; X86-BMI-NEXT: movl %edi, 4(%eax)
|
|
; X86-BMI-NEXT: movl %esi, (%eax)
|
|
; X86-BMI-NEXT: addl $4, %esp
|
|
; X86-BMI-NEXT: popl %esi
|
|
; X86-BMI-NEXT: popl %edi
|
|
; X86-BMI-NEXT: retl $4
|
|
;
|
|
; X86-NOBMI-LABEL: test_i128_smax:
|
|
; X86-NOBMI: # %bb.0:
|
|
; X86-NOBMI-NEXT: pushl %edi
|
|
; X86-NOBMI-NEXT: pushl %esi
|
|
; X86-NOBMI-NEXT: pushl %eax
|
|
; X86-NOBMI-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
; X86-NOBMI-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
; X86-NOBMI-NEXT: testl %ecx, %ecx
|
|
; X86-NOBMI-NEXT: movl $0, %edx
|
|
; X86-NOBMI-NEXT: movl $0, %esi
|
|
; X86-NOBMI-NEXT: movl $0, %edi
|
|
; X86-NOBMI-NEXT: js .LBB8_2
|
|
; X86-NOBMI-NEXT: # %bb.1:
|
|
; X86-NOBMI-NEXT: movl {{[0-9]+}}(%esp), %edi
|
|
; X86-NOBMI-NEXT: movl {{[0-9]+}}(%esp), %edx
|
|
; X86-NOBMI-NEXT: movl {{[0-9]+}}(%esp), %esi
|
|
; X86-NOBMI-NEXT: .LBB8_2:
|
|
; X86-NOBMI-NEXT: jg .LBB8_4
|
|
; X86-NOBMI-NEXT: # %bb.3:
|
|
; X86-NOBMI-NEXT: xorl %ecx, %ecx
|
|
; X86-NOBMI-NEXT: .LBB8_4:
|
|
; X86-NOBMI-NEXT: movl %ecx, 12(%eax)
|
|
; X86-NOBMI-NEXT: movl %edi, 8(%eax)
|
|
; X86-NOBMI-NEXT: movl %esi, 4(%eax)
|
|
; X86-NOBMI-NEXT: movl %edx, (%eax)
|
|
; X86-NOBMI-NEXT: addl $4, %esp
|
|
; X86-NOBMI-NEXT: popl %esi
|
|
; X86-NOBMI-NEXT: popl %edi
|
|
; X86-NOBMI-NEXT: retl $4
|
|
%r = call i128 @llvm.smax.i128(i128 %a, i128 0)
|
|
ret i128 %r
|
|
}
|
|
|
|
define i128 @test_i128_smin(i128 %a) nounwind {
|
|
; X64-LABEL: test_i128_smin:
|
|
; X64: # %bb.0:
|
|
; X64-NEXT: movq %rdi, %rax
|
|
; X64-NEXT: movq %rsi, %rdx
|
|
; X64-NEXT: sarq $63, %rdx
|
|
; X64-NEXT: andq %rdx, %rax
|
|
; X64-NEXT: andq %rsi, %rdx
|
|
; X64-NEXT: retq
|
|
;
|
|
; X86-LABEL: test_i128_smin:
|
|
; X86: # %bb.0:
|
|
; X86-NEXT: pushl %edi
|
|
; X86-NEXT: pushl %esi
|
|
; X86-NEXT: pushl %eax
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
; X86-NEXT: movl %ecx, %edx
|
|
; X86-NEXT: sarl $31, %edx
|
|
; X86-NEXT: andl %edx, %ecx
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
|
|
; X86-NEXT: andl %edx, %esi
|
|
; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
|
|
; X86-NEXT: andl %edx, %edi
|
|
; X86-NEXT: andl {{[0-9]+}}(%esp), %edx
|
|
; X86-NEXT: movl %ecx, 12(%eax)
|
|
; X86-NEXT: movl %edx, 8(%eax)
|
|
; X86-NEXT: movl %edi, 4(%eax)
|
|
; X86-NEXT: movl %esi, (%eax)
|
|
; X86-NEXT: addl $4, %esp
|
|
; X86-NEXT: popl %esi
|
|
; X86-NEXT: popl %edi
|
|
; X86-NEXT: retl $4
|
|
%r = call i128 @llvm.smin.i128(i128 %a, i128 0)
|
|
ret i128 %r
|
|
}
|