[X86] Test scalar integer absolutes on 32-bit targets with/without CMOV

llvm-svn: 315711
This commit is contained in:
Simon Pilgrim 2017-10-13 17:09:20 +00:00
parent be3724b5e1
commit c4977fa9a1
1 changed files with 35 additions and 18 deletions

View 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: