[llvm] r348705 - [x86] add 32-bit RUN for tests and test with opaque constants; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 8 07:34:09 PST 2018
Author: spatel
Date: Sat Dec 8 07:34:09 2018
New Revision: 348705
URL: http://llvm.org/viewvc/llvm-project?rev=348705&view=rev
Log:
[x86] add 32-bit RUN for tests and test with opaque constants; NFC
The opaque constant test is reduced from a Chrome file that
infinite-looped with rL347917.
Modified:
llvm/trunk/test/CodeGen/X86/bool-math.ll
Modified: llvm/trunk/test/CodeGen/X86/bool-math.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/bool-math.ll?rev=348705&r1=348704&r2=348705&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/bool-math.ll (original)
+++ llvm/trunk/test/CodeGen/X86/bool-math.ll Sat Dec 8 07:34:09 2018
@@ -1,13 +1,21 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefix=X64
+; RUN: llc < %s -mtriple=i686-- | FileCheck %s --check-prefix=X32
define i32 @sub_zext_cmp_mask_same_size_result(i32 %x) {
-; CHECK-LABEL: sub_zext_cmp_mask_same_size_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
-; CHECK-NEXT: andl $1, %edi
-; CHECK-NEXT: leal -28(%rdi), %eax
-; CHECK-NEXT: retq
+; X64-LABEL: sub_zext_cmp_mask_same_size_result:
+; X64: # %bb.0:
+; X64-NEXT: # kill: def $edi killed $edi def $rdi
+; X64-NEXT: andl $1, %edi
+; X64-NEXT: leal -28(%rdi), %eax
+; X64-NEXT: retq
+;
+; X32-LABEL: sub_zext_cmp_mask_same_size_result:
+; X32: # %bb.0:
+; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: orl $-28, %eax
+; X32-NEXT: retl
%a = and i32 %x, 1
%c = icmp eq i32 %a, 0
%z = zext i1 %c to i32
@@ -16,12 +24,19 @@ define i32 @sub_zext_cmp_mask_same_size_
}
define i32 @sub_zext_cmp_mask_wider_result(i8 %x) {
-; CHECK-LABEL: sub_zext_cmp_mask_wider_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
-; CHECK-NEXT: andl $1, %edi
-; CHECK-NEXT: leal 26(%rdi), %eax
-; CHECK-NEXT: retq
+; X64-LABEL: sub_zext_cmp_mask_wider_result:
+; X64: # %bb.0:
+; X64-NEXT: # kill: def $edi killed $edi def $rdi
+; X64-NEXT: andl $1, %edi
+; X64-NEXT: leal 26(%rdi), %eax
+; X64-NEXT: retq
+;
+; X32-LABEL: sub_zext_cmp_mask_wider_result:
+; X32: # %bb.0:
+; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: orl $26, %eax
+; X32-NEXT: retl
%a = and i8 %x, 1
%c = icmp eq i8 %a, 0
%z = zext i1 %c to i32
@@ -30,13 +45,21 @@ define i32 @sub_zext_cmp_mask_wider_resu
}
define i8 @sub_zext_cmp_mask_narrower_result(i32 %x) {
-; CHECK-LABEL: sub_zext_cmp_mask_narrower_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: movl %edi, %eax
-; CHECK-NEXT: andl $1, %eax
-; CHECK-NEXT: orb $46, %al
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
-; CHECK-NEXT: retq
+; X64-LABEL: sub_zext_cmp_mask_narrower_result:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: andl $1, %eax
+; X64-NEXT: orb $46, %al
+; X64-NEXT: # kill: def $al killed $al killed $eax
+; X64-NEXT: retq
+;
+; X32-LABEL: sub_zext_cmp_mask_narrower_result:
+; X32: # %bb.0:
+; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: orb $46, %al
+; X32-NEXT: # kill: def $al killed $al killed $eax
+; X32-NEXT: retl
%a = and i32 %x, 1
%c = icmp eq i32 %a, 0
%z = zext i1 %c to i8
@@ -45,13 +68,20 @@ define i8 @sub_zext_cmp_mask_narrower_re
}
define i8 @add_zext_cmp_mask_same_size_result(i8 %x) {
-; CHECK-LABEL: add_zext_cmp_mask_same_size_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: movl %edi, %eax
-; CHECK-NEXT: andb $1, %al
-; CHECK-NEXT: xorb $27, %al
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
-; CHECK-NEXT: retq
+; X64-LABEL: add_zext_cmp_mask_same_size_result:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: andb $1, %al
+; X64-NEXT: xorb $27, %al
+; X64-NEXT: # kill: def $al killed $al killed $eax
+; X64-NEXT: retq
+;
+; X32-LABEL: add_zext_cmp_mask_same_size_result:
+; X32: # %bb.0:
+; X32-NEXT: movb {{[0-9]+}}(%esp), %al
+; X32-NEXT: andb $1, %al
+; X32-NEXT: xorb $27, %al
+; X32-NEXT: retl
%a = and i8 %x, 1
%c = icmp eq i8 %a, 0
%z = zext i1 %c to i8
@@ -60,12 +90,19 @@ define i8 @add_zext_cmp_mask_same_size_r
}
define i32 @add_zext_cmp_mask_wider_result(i8 %x) {
-; CHECK-LABEL: add_zext_cmp_mask_wider_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: movl %edi, %eax
-; CHECK-NEXT: andl $1, %eax
-; CHECK-NEXT: xorl $27, %eax
-; CHECK-NEXT: retq
+; X64-LABEL: add_zext_cmp_mask_wider_result:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: andl $1, %eax
+; X64-NEXT: xorl $27, %eax
+; X64-NEXT: retq
+;
+; X32-LABEL: add_zext_cmp_mask_wider_result:
+; X32: # %bb.0:
+; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: xorl $27, %eax
+; X32-NEXT: retl
%a = and i8 %x, 1
%c = icmp eq i8 %a, 0
%z = zext i1 %c to i32
@@ -74,13 +111,21 @@ define i32 @add_zext_cmp_mask_wider_resu
}
define i8 @add_zext_cmp_mask_narrower_result(i32 %x) {
-; CHECK-LABEL: add_zext_cmp_mask_narrower_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: movl %edi, %eax
-; CHECK-NEXT: andl $1, %eax
-; CHECK-NEXT: xorb $43, %al
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
-; CHECK-NEXT: retq
+; X64-LABEL: add_zext_cmp_mask_narrower_result:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: andl $1, %eax
+; X64-NEXT: xorb $43, %al
+; X64-NEXT: # kill: def $al killed $al killed $eax
+; X64-NEXT: retq
+;
+; X32-LABEL: add_zext_cmp_mask_narrower_result:
+; X32: # %bb.0:
+; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: xorb $43, %al
+; X32-NEXT: # kill: def $al killed $al killed $eax
+; X32-NEXT: retl
%a = and i32 %x, 1
%c = icmp eq i32 %a, 0
%z = zext i1 %c to i8
@@ -89,12 +134,19 @@ define i8 @add_zext_cmp_mask_narrower_re
}
define i32 @low_bit_select_constants_bigger_false_same_size_result(i32 %x) {
-; CHECK-LABEL: low_bit_select_constants_bigger_false_same_size_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
-; CHECK-NEXT: andl $1, %edi
-; CHECK-NEXT: leal 42(%rdi), %eax
-; CHECK-NEXT: retq
+; X64-LABEL: low_bit_select_constants_bigger_false_same_size_result:
+; X64: # %bb.0:
+; X64-NEXT: # kill: def $edi killed $edi def $rdi
+; X64-NEXT: andl $1, %edi
+; X64-NEXT: leal 42(%rdi), %eax
+; X64-NEXT: retq
+;
+; X32-LABEL: low_bit_select_constants_bigger_false_same_size_result:
+; X32: # %bb.0:
+; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: orl $42, %eax
+; X32-NEXT: retl
%a = and i32 %x, 1
%c = icmp eq i32 %a, 0
%r = select i1 %c, i32 42, i32 43
@@ -102,12 +154,20 @@ define i32 @low_bit_select_constants_big
}
define i64 @low_bit_select_constants_bigger_false_wider_result(i32 %x) {
-; CHECK-LABEL: low_bit_select_constants_bigger_false_wider_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
-; CHECK-NEXT: andl $1, %edi
-; CHECK-NEXT: leaq 26(%rdi), %rax
-; CHECK-NEXT: retq
+; X64-LABEL: low_bit_select_constants_bigger_false_wider_result:
+; X64: # %bb.0:
+; X64-NEXT: # kill: def $edi killed $edi def $rdi
+; X64-NEXT: andl $1, %edi
+; X64-NEXT: leaq 26(%rdi), %rax
+; X64-NEXT: retq
+;
+; X32-LABEL: low_bit_select_constants_bigger_false_wider_result:
+; X32: # %bb.0:
+; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: orl $26, %eax
+; X32-NEXT: xorl %edx, %edx
+; X32-NEXT: retl
%a = and i32 %x, 1
%c = icmp eq i32 %a, 0
%r = select i1 %c, i64 26, i64 27
@@ -115,13 +175,21 @@ define i64 @low_bit_select_constants_big
}
define i16 @low_bit_select_constants_bigger_false_narrower_result(i32 %x) {
-; CHECK-LABEL: low_bit_select_constants_bigger_false_narrower_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
-; CHECK-NEXT: andl $1, %edi
-; CHECK-NEXT: leal 36(%rdi), %eax
-; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
-; CHECK-NEXT: retq
+; X64-LABEL: low_bit_select_constants_bigger_false_narrower_result:
+; X64: # %bb.0:
+; X64-NEXT: # kill: def $edi killed $edi def $rdi
+; X64-NEXT: andl $1, %edi
+; X64-NEXT: leal 36(%rdi), %eax
+; X64-NEXT: # kill: def $ax killed $ax killed $eax
+; X64-NEXT: retq
+;
+; X32-LABEL: low_bit_select_constants_bigger_false_narrower_result:
+; X32: # %bb.0:
+; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: orl $36, %eax
+; X32-NEXT: # kill: def $ax killed $ax killed $eax
+; X32-NEXT: retl
%a = and i32 %x, 1
%c = icmp eq i32 %a, 0
%r = select i1 %c, i16 36, i16 37
@@ -129,13 +197,20 @@ define i16 @low_bit_select_constants_big
}
define i8 @low_bit_select_constants_bigger_true_same_size_result(i8 %x) {
-; CHECK-LABEL: low_bit_select_constants_bigger_true_same_size_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: movl %edi, %eax
-; CHECK-NEXT: andb $1, %al
-; CHECK-NEXT: xorb $-29, %al
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
-; CHECK-NEXT: retq
+; X64-LABEL: low_bit_select_constants_bigger_true_same_size_result:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: andb $1, %al
+; X64-NEXT: xorb $-29, %al
+; X64-NEXT: # kill: def $al killed $al killed $eax
+; X64-NEXT: retq
+;
+; X32-LABEL: low_bit_select_constants_bigger_true_same_size_result:
+; X32: # %bb.0:
+; X32-NEXT: movb {{[0-9]+}}(%esp), %al
+; X32-NEXT: andb $1, %al
+; X32-NEXT: xorb $-29, %al
+; X32-NEXT: retl
%a = and i8 %x, 1
%c = icmp eq i8 %a, 0
%r = select i1 %c, i8 227, i8 226
@@ -143,12 +218,19 @@ define i8 @low_bit_select_constants_bigg
}
define i32 @low_bit_select_constants_bigger_true_wider_result(i8 %x) {
-; CHECK-LABEL: low_bit_select_constants_bigger_true_wider_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: movl %edi, %eax
-; CHECK-NEXT: andl $1, %eax
-; CHECK-NEXT: xorl $227, %eax
-; CHECK-NEXT: retq
+; X64-LABEL: low_bit_select_constants_bigger_true_wider_result:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: andl $1, %eax
+; X64-NEXT: xorl $227, %eax
+; X64-NEXT: retq
+;
+; X32-LABEL: low_bit_select_constants_bigger_true_wider_result:
+; X32: # %bb.0:
+; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: xorl $227, %eax
+; X32-NEXT: retl
%a = and i8 %x, 1
%c = icmp eq i8 %a, 0
%r = select i1 %c, i32 227, i32 226
@@ -156,16 +238,53 @@ define i32 @low_bit_select_constants_big
}
define i8 @low_bit_select_constants_bigger_true_narrower_result(i16 %x) {
-; CHECK-LABEL: low_bit_select_constants_bigger_true_narrower_result:
-; CHECK: # %bb.0:
-; CHECK-NEXT: movl %edi, %eax
-; CHECK-NEXT: andl $1, %eax
-; CHECK-NEXT: xorb $41, %al
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
-; CHECK-NEXT: retq
+; X64-LABEL: low_bit_select_constants_bigger_true_narrower_result:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: andl $1, %eax
+; X64-NEXT: xorb $41, %al
+; X64-NEXT: # kill: def $al killed $al killed $eax
+; X64-NEXT: retq
+;
+; X32-LABEL: low_bit_select_constants_bigger_true_narrower_result:
+; X32: # %bb.0:
+; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: xorb $41, %al
+; X32-NEXT: # kill: def $al killed $al killed $eax
+; X32-NEXT: retl
%a = and i16 %x, 1
%c = icmp eq i16 %a, 0
%r = select i1 %c, i8 41, i8 40
ret i8 %r
}
+; Truncation hoisting must not occur with opaque constants
+; because that can induce infinite looping.
+
+define i1 @opaque_constant(i48 %x, i48 %y) {
+; X64-LABEL: opaque_constant:
+; X64: # %bb.0:
+; X64-NEXT: movq %rsi, %rax
+; X64-NEXT: shrq $32, %rdi
+; X64-NEXT: shrq $32, %rax
+; X64-NEXT: xorl %edi, %eax
+; X64-NEXT: andl $1, %eax
+; X64-NEXT: # kill: def $al killed $al killed $rax
+; X64-NEXT: retq
+;
+; X32-LABEL: opaque_constant:
+; X32: # %bb.0:
+; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: xorl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: andl $1, %eax
+; X32-NEXT: # kill: def $al killed $al killed $eax
+; X32-NEXT: retl
+ %andx = and i48 %x, 4294967296
+ %andy = and i48 %y, 4294967296
+ %cmp1 = icmp ne i48 %andx, 0
+ %cmp2 = icmp ne i48 %andy, 0
+ %r = xor i1 %cmp1, %cmp2
+ ret i1 %r
+}
+
More information about the llvm-commits
mailing list