2017-06-13 01:31:36 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2016-10-12 00:04:37 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
|
|
|
|
|
2016-10-12 00:49:52 +08:00
|
|
|
define i32 @mask_negated_zext_bool1(i1 %x) {
|
|
|
|
; CHECK-LABEL: mask_negated_zext_bool1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0:
|
2016-10-12 00:04:37 +08:00
|
|
|
; CHECK-NEXT: movl %edi, %eax
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: andl $1, %eax
|
2016-10-12 00:04:37 +08:00
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%ext = zext i1 %x to i32
|
|
|
|
%neg = sub i32 0, %ext
|
|
|
|
%and = and i32 %neg, 1
|
|
|
|
ret i32 %and
|
|
|
|
}
|
|
|
|
|
2016-10-12 00:49:52 +08:00
|
|
|
define i32 @mask_negated_zext_bool2(i1 zeroext %x) {
|
|
|
|
; CHECK-LABEL: mask_negated_zext_bool2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0:
|
2017-09-19 06:05:35 +08:00
|
|
|
; CHECK-NEXT: movl %edi, %eax
|
2016-10-12 00:04:37 +08:00
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%ext = zext i1 %x to i32
|
|
|
|
%neg = sub i32 0, %ext
|
|
|
|
%and = and i32 %neg, 1
|
|
|
|
ret i32 %and
|
|
|
|
}
|
|
|
|
|
2016-10-12 00:49:52 +08:00
|
|
|
define <4 x i32> @mask_negated_zext_bool_vec(<4 x i1> %x) {
|
|
|
|
; CHECK-LABEL: mask_negated_zext_bool_vec:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0:
|
2016-10-12 00:26:36 +08:00
|
|
|
; CHECK-NEXT: andps {{.*}}(%rip), %xmm0
|
2016-10-12 00:04:37 +08:00
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%ext = zext <4 x i1> %x to <4 x i32>
|
|
|
|
%neg = sub <4 x i32> zeroinitializer, %ext
|
|
|
|
%and = and <4 x i32> %neg, <i32 1, i32 1, i32 1, i32 1>
|
|
|
|
ret <4 x i32> %and
|
|
|
|
}
|
|
|
|
|
2016-10-12 00:49:52 +08:00
|
|
|
define i32 @mask_negated_sext_bool1(i1 %x) {
|
|
|
|
; CHECK-LABEL: mask_negated_sext_bool1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0:
|
2016-10-12 00:49:52 +08:00
|
|
|
; CHECK-NEXT: movl %edi, %eax
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: andl $1, %eax
|
2016-10-12 00:49:52 +08:00
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%ext = sext i1 %x to i32
|
|
|
|
%neg = sub i32 0, %ext
|
|
|
|
%and = and i32 %neg, 1
|
|
|
|
ret i32 %and
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @mask_negated_sext_bool2(i1 zeroext %x) {
|
|
|
|
; CHECK-LABEL: mask_negated_sext_bool2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0:
|
2017-09-19 06:05:35 +08:00
|
|
|
; CHECK-NEXT: movl %edi, %eax
|
2016-10-12 00:49:52 +08:00
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%ext = sext i1 %x to i32
|
|
|
|
%neg = sub i32 0, %ext
|
|
|
|
%and = and i32 %neg, 1
|
|
|
|
ret i32 %and
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i32> @mask_negated_sext_bool_vec(<4 x i1> %x) {
|
|
|
|
; CHECK-LABEL: mask_negated_sext_bool_vec:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0:
|
2016-10-12 01:05:52 +08:00
|
|
|
; CHECK-NEXT: andps {{.*}}(%rip), %xmm0
|
2016-10-12 00:49:52 +08:00
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%ext = sext <4 x i1> %x to <4 x i32>
|
|
|
|
%neg = sub <4 x i32> zeroinitializer, %ext
|
|
|
|
%and = and <4 x i32> %neg, <i32 1, i32 1, i32 1, i32 1>
|
|
|
|
ret <4 x i32> %and
|
|
|
|
}
|
|
|
|
|