[llvm] r311052 - [x86] add cmov promotion tests for D36711; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 16 15:50:11 PDT 2017
Author: spatel
Date: Wed Aug 16 15:50:11 2017
New Revision: 311052
URL: http://llvm.org/viewvc/llvm-project?rev=311052&view=rev
Log:
[x86] add cmov promotion tests for D36711; NFC
This way we can see what the current codegen looks like.
I've also explicitly added/removed the cmov attribute from the RUN lines,
so we know exactly what we're checking in the runs.
Added:
llvm/trunk/test/CodeGen/X86/cmov-promotion.ll
Added: llvm/trunk/test/CodeGen/X86/cmov-promotion.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov-promotion.ll?rev=311052&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/cmov-promotion.ll (added)
+++ llvm/trunk/test/CodeGen/X86/cmov-promotion.ll Wed Aug 16 15:50:11 2017
@@ -0,0 +1,107 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+cmov | FileCheck %s --check-prefix=CMOV
+; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=-cmov | FileCheck %s --check-prefix=NO_CMOV
+
+define i32 @cmov_zpromotion_16_to_32(i1 %c) {
+; CMOV-LABEL: cmov_zpromotion_16_to_32:
+; CMOV: # BB#0:
+; CMOV-NEXT: testb $1, %dil
+; CMOV-NEXT: movw $12414, %ax # imm = 0x307E
+; CMOV-NEXT: movw $-1, %cx
+; CMOV-NEXT: cmovnew %ax, %cx
+; CMOV-NEXT: movzwl %cx, %eax
+; CMOV-NEXT: retq
+;
+; NO_CMOV-LABEL: cmov_zpromotion_16_to_32:
+; NO_CMOV: # BB#0:
+; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
+; NO_CMOV-NEXT: movw $12414, %ax # imm = 0x307E
+; NO_CMOV-NEXT: jne .LBB0_2
+; NO_CMOV-NEXT: # BB#1:
+; NO_CMOV-NEXT: movw $-1, %ax
+; NO_CMOV-NEXT: .LBB0_2:
+; NO_CMOV-NEXT: movzwl %ax, %eax
+; NO_CMOV-NEXT: retl
+ %t0 = select i1 %c, i16 12414, i16 -1
+ %ret = zext i16 %t0 to i32
+ ret i32 %ret
+}
+
+define i64 @cmov_zpromotion_16_to_64(i1 %c) {
+; CMOV-LABEL: cmov_zpromotion_16_to_64:
+; CMOV: # BB#0:
+; CMOV-NEXT: testb $1, %dil
+; CMOV-NEXT: movw $12414, %ax # imm = 0x307E
+; CMOV-NEXT: movw $-1, %cx
+; CMOV-NEXT: cmovnew %ax, %cx
+; CMOV-NEXT: movzwl %cx, %eax
+; CMOV-NEXT: retq
+;
+; NO_CMOV-LABEL: cmov_zpromotion_16_to_64:
+; NO_CMOV: # BB#0:
+; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
+; NO_CMOV-NEXT: movw $12414, %ax # imm = 0x307E
+; NO_CMOV-NEXT: jne .LBB1_2
+; NO_CMOV-NEXT: # BB#1:
+; NO_CMOV-NEXT: movw $-1, %ax
+; NO_CMOV-NEXT: .LBB1_2:
+; NO_CMOV-NEXT: movzwl %ax, %eax
+; NO_CMOV-NEXT: xorl %edx, %edx
+; NO_CMOV-NEXT: retl
+ %t0 = select i1 %c, i16 12414, i16 -1
+ %ret = zext i16 %t0 to i64
+ ret i64 %ret
+}
+
+define i32 @cmov_spromotion_16_to_32(i1 %c) {
+; CMOV-LABEL: cmov_spromotion_16_to_32:
+; CMOV: # BB#0:
+; CMOV-NEXT: testb $1, %dil
+; CMOV-NEXT: movw $12414, %ax # imm = 0x307E
+; CMOV-NEXT: movw $-1, %cx
+; CMOV-NEXT: cmovnew %ax, %cx
+; CMOV-NEXT: movswl %cx, %eax
+; CMOV-NEXT: retq
+;
+; NO_CMOV-LABEL: cmov_spromotion_16_to_32:
+; NO_CMOV: # BB#0:
+; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
+; NO_CMOV-NEXT: movw $12414, %ax # imm = 0x307E
+; NO_CMOV-NEXT: jne .LBB2_2
+; NO_CMOV-NEXT: # BB#1:
+; NO_CMOV-NEXT: movw $-1, %ax
+; NO_CMOV-NEXT: .LBB2_2:
+; NO_CMOV-NEXT: cwtl
+; NO_CMOV-NEXT: retl
+ %t0 = select i1 %c, i16 12414, i16 -1
+ %ret = sext i16 %t0 to i32
+ ret i32 %ret
+}
+
+define i64 @cmov_spromotion_16_to_64(i1 %c) {
+; CMOV-LABEL: cmov_spromotion_16_to_64:
+; CMOV: # BB#0:
+; CMOV-NEXT: testb $1, %dil
+; CMOV-NEXT: movw $12414, %ax # imm = 0x307E
+; CMOV-NEXT: movw $-1, %cx
+; CMOV-NEXT: cmovnew %ax, %cx
+; CMOV-NEXT: movswq %cx, %rax
+; CMOV-NEXT: retq
+;
+; NO_CMOV-LABEL: cmov_spromotion_16_to_64:
+; NO_CMOV: # BB#0:
+; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
+; NO_CMOV-NEXT: movw $12414, %ax # imm = 0x307E
+; NO_CMOV-NEXT: jne .LBB3_2
+; NO_CMOV-NEXT: # BB#1:
+; NO_CMOV-NEXT: movw $-1, %ax
+; NO_CMOV-NEXT: .LBB3_2:
+; NO_CMOV-NEXT: cwtl
+; NO_CMOV-NEXT: movl %eax, %edx
+; NO_CMOV-NEXT: sarl $31, %edx
+; NO_CMOV-NEXT: retl
+ %t0 = select i1 %c, i16 12414, i16 -1
+ %ret = sext i16 %t0 to i64
+ ret i64 %ret
+}
+
More information about the llvm-commits
mailing list