[X86] Test scalar integer absolutes on 32-bit targets with/without CMOV
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 13 Oct 2017 17:09:20 +0000 (17:09 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 13 Oct 2017 17:09:20 +0000 (17:09 +0000)
llvm-svn: 315711

llvm/test/CodeGen/X86/iabs.ll

index 16310d16f05a436498232736d6d154d73cf3b103..4088f023978e227c406af2988d6d23734c28ca20 100644 (file)
@@ -1,5 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X86
+; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X86 --check-prefix=X86-NO-CMOV
+; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+cmov | FileCheck %s --check-prefix=X86 --check-prefix=X86-CMOV
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
 
 ;; Integer absolute value, should produce something at least as good as:
@@ -33,15 +34,23 @@ define i8 @test_i8(i8 %a) nounwind {
 }
 
 define i16 @test_i16(i16 %a) nounwind {
-; X86-LABEL: test_i16:
-; X86:       # BB#0:
-; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movl %eax, %ecx
-; X86-NEXT:    sarw $15, %cx
-; X86-NEXT:    addl %ecx, %eax
-; X86-NEXT:    xorl %ecx, %eax
-; X86-NEXT:    # kill: %AX<def> %AX<kill> %EAX<kill>
-; X86-NEXT:    retl
+; X86-NO-CMOV-LABEL: test_i16:
+; X86-NO-CMOV:       # BB#0:
+; X86-NO-CMOV-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
+; X86-NO-CMOV-NEXT:    movl %eax, %ecx
+; X86-NO-CMOV-NEXT:    sarw $15, %cx
+; X86-NO-CMOV-NEXT:    addl %ecx, %eax
+; X86-NO-CMOV-NEXT:    xorl %ecx, %eax
+; X86-NO-CMOV-NEXT:    # kill: %AX<def> %AX<kill> %EAX<kill>
+; X86-NO-CMOV-NEXT:    retl
+;
+; X86-CMOV-LABEL: test_i16:
+; X86-CMOV:       # BB#0:
+; X86-CMOV-NEXT:    movzwl {{[0-9]+}}(%esp), %ecx
+; X86-CMOV-NEXT:    movl %ecx, %eax
+; X86-CMOV-NEXT:    negw %ax
+; X86-CMOV-NEXT:    cmovlw %cx, %ax
+; X86-CMOV-NEXT:    retl
 ;
 ; X64-LABEL: test_i16:
 ; X64:       # BB#0:
@@ -56,14 +65,22 @@ define i16 @test_i16(i16 %a) nounwind {
 }
 
 define i32 @test_i32(i32 %a) nounwind {
-; X86-LABEL: test_i32:
-; X86:       # BB#0:
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movl %eax, %ecx
-; X86-NEXT:    sarl $31, %ecx
-; X86-NEXT:    addl %ecx, %eax
-; X86-NEXT:    xorl %ecx, %eax
-; X86-NEXT:    retl
+; X86-NO-CMOV-LABEL: test_i32:
+; X86-NO-CMOV:       # BB#0:
+; X86-NO-CMOV-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NO-CMOV-NEXT:    movl %eax, %ecx
+; X86-NO-CMOV-NEXT:    sarl $31, %ecx
+; X86-NO-CMOV-NEXT:    addl %ecx, %eax
+; X86-NO-CMOV-NEXT:    xorl %ecx, %eax
+; X86-NO-CMOV-NEXT:    retl
+;
+; X86-CMOV-LABEL: test_i32:
+; X86-CMOV:       # BB#0:
+; X86-CMOV-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X86-CMOV-NEXT:    movl %ecx, %eax
+; X86-CMOV-NEXT:    negl %eax
+; X86-CMOV-NEXT:    cmovll %ecx, %eax
+; X86-CMOV-NEXT:    retl
 ;
 ; X64-LABEL: test_i32:
 ; X64:       # BB#0: