From 0a25d0e2466f1f414b6c6cfed9aad603313fdf99 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 16 Mar 2017 15:10:42 +0000 Subject: [PATCH] [X86] Add PR22338 test case git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297957 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/X86/pr22338.ll | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 test/CodeGen/X86/pr22338.ll diff --git a/test/CodeGen/X86/pr22338.ll b/test/CodeGen/X86/pr22338.ll new file mode 100644 index 00000000000..e0645d1ef55 --- /dev/null +++ b/test/CodeGen/X86/pr22338.ll @@ -0,0 +1,57 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=i686-unknown-linux-gnu | FileCheck %s --check-prefix=X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefix=X64 + +define i32 @fn() { +; X86-LABEL: fn: +; X86: # BB#0: # %entry +; X86-NEXT: cmpl $1, %eax +; X86-NEXT: sete %cl +; X86-NEXT: movl $-1, %eax +; X86-NEXT: jne .LBB0_2 +; X86-NEXT: # BB#1: # %entry +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: .LBB0_2: # %entry +; X86-NEXT: addb %cl, %cl +; X86-NEXT: shll %cl, %eax +; X86-NEXT: .p2align 4, 0x90 +; X86-NEXT: .LBB0_3: # %bb1 +; X86-NEXT: # =>This Inner Loop Header: Depth=1 +; X86-NEXT: testl %eax, %eax +; X86-NEXT: je .LBB0_3 +; X86-NEXT: # BB#4: # %bb2 +; X86-NEXT: retl +; +; X64-LABEL: fn: +; X64: # BB#0: # %entry +; X64-NEXT: xorl %edx, %edx +; X64-NEXT: cmpl $1, %eax +; X64-NEXT: sete %cl +; X64-NEXT: movl $-1, %eax +; X64-NEXT: cmovel %edx, %eax +; X64-NEXT: addb %cl, %cl +; X64-NEXT: shll %cl, %eax +; X64-NEXT: .p2align 4, 0x90 +; X64-NEXT: .LBB0_1: # %bb1 +; X64-NEXT: # =>This Inner Loop Header: Depth=1 +; X64-NEXT: testl %eax, %eax +; X64-NEXT: je .LBB0_1 +; X64-NEXT: # BB#2: # %bb2 +; X64-NEXT: retq +entry: + %cmp1 = icmp ne i32 undef, 1 + %cmp2 = icmp eq i32 undef, 1 + %sel1 = select i1 %cmp1, i32 0, i32 2 + %sel2 = select i1 %cmp2, i32 2, i32 0 + %sext = sext i1 %cmp1 to i32 + %shl1 = shl i32 %sext, %sel1 + %shl2 = shl i32 %sext, %sel2 + %tobool = icmp eq i32 %shl1, 0 + br label %bb1 + +bb1: ; preds = %bb1, %entry + br i1 %tobool, label %bb1, label %bb2 + +bb2: ; preds = %bb1 + ret i32 %shl2 +} -- 2.50.1