From 250620ab19d667ea1e03f53dc185ce19202e761d Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 21 Feb 2023 00:01:43 -0800 Subject: [PATCH] [X86] Precommit a test This patch precommits a test for: https://github.com/llvm/llvm-project/issues/60374 --- llvm/test/CodeGen/X86/umax.ll | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/llvm/test/CodeGen/X86/umax.ll b/llvm/test/CodeGen/X86/umax.ll index 2d16dcf..ca5ea3a 100644 --- a/llvm/test/CodeGen/X86/umax.ll +++ b/llvm/test/CodeGen/X86/umax.ll @@ -104,6 +104,25 @@ define i32 @test_i32(i32 %a, i32 %b) nounwind { ret i32 %r } +define i32 @test_i32_1(i32 %a) nounwind { +; X64-LABEL: test_i32_1: +; X64: # %bb.0: +; X64-NEXT: cmpl $2, %edi +; X64-NEXT: movl $1, %eax +; X64-NEXT: cmovael %edi, %eax +; X64-NEXT: retq +; +; X86-LABEL: test_i32_1: +; X86: # %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: cmpl $2, %ecx +; X86-NEXT: movl $1, %eax +; X86-NEXT: cmovael %ecx, %eax +; X86-NEXT: retl + %r = call i32 @llvm.umax.i32(i32 %a, i32 1) + ret i32 %r +} + define i64 @test_i64(i64 %a, i64 %b) nounwind { ; X64-LABEL: test_i64: ; X64: # %bb.0: @@ -134,6 +153,32 @@ define i64 @test_i64(i64 %a, i64 %b) nounwind { ret i64 %r } +define i64 @test_i64_1(i64 %a) nounwind { +; X64-LABEL: test_i64_1: +; X64: # %bb.0: +; X64-NEXT: cmpq $2, %rdi +; X64-NEXT: movl $1, %eax +; X64-NEXT: cmovaeq %rdi, %rax +; X64-NEXT: retq +; +; X86-LABEL: test_i64_1: +; X86: # %bb.0: +; X86-NEXT: pushl %esi +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; X86-NEXT: cmpl $2, %ecx +; X86-NEXT: movl $1, %eax +; X86-NEXT: movl $1, %esi +; X86-NEXT: cmovael %ecx, %esi +; X86-NEXT: testl %edx, %edx +; X86-NEXT: cmovnel %ecx, %eax +; X86-NEXT: cmovel %esi, %eax +; X86-NEXT: popl %esi +; X86-NEXT: retl + %r = call i64 @llvm.umax.i64(i64 %a, i64 1) + ret i64 %r +} + define i128 @test_i128(i128 %a, i128 %b) nounwind { ; X64-LABEL: test_i128: ; X64: # %bb.0: -- 2.7.4