2017-05-13 04:53:48 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2020-11-16 09:44:06 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=-bmi | FileCheck %s --check-prefix=ALL
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+bmi | FileCheck %s --check-prefix=ALL
|
2016-12-03 01:48:48 +08:00
|
|
|
|
|
|
|
; Clear high bits via shift, set them with xor (not), then mask them off.
|
|
|
|
|
|
|
|
define i32 @shrink_xor_constant1(i32 %x) {
|
2016-12-05 23:58:21 +08:00
|
|
|
; ALL-LABEL: shrink_xor_constant1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0:
|
2016-12-05 23:58:21 +08:00
|
|
|
; ALL-NEXT: movl %edi, %eax
|
2018-11-23 03:24:10 +08:00
|
|
|
; ALL-NEXT: notl %eax
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: shrl $31, %eax
|
2016-12-05 23:58:21 +08:00
|
|
|
; ALL-NEXT: retq
|
2016-12-03 01:48:48 +08:00
|
|
|
%sh = lshr i32 %x, 31
|
|
|
|
%not = xor i32 %sh, -1
|
|
|
|
%and = and i32 %not, 1
|
|
|
|
ret i32 %and
|
|
|
|
}
|
|
|
|
|
2017-05-13 04:53:48 +08:00
|
|
|
define <4 x i32> @shrink_xor_constant1_splat(<4 x i32> %x) {
|
|
|
|
; ALL-LABEL: shrink_xor_constant1_splat:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0:
|
[DAGCombine] Prune unnused nodes.
Summary:
Nodes that have no uses are eventually pruned when they are selected
from the worklist. Record nodes newly added to the worklist or DAG and
perform pruning after every combine attempt.
Reviewers: efriedma, RKSimon, craig.topper, spatel, jyknight
Reviewed By: jyknight
Subscribers: jdoerfert, jyknight, nemanjai, jvesely, nhaehnle, javed.absar, hiraditya, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58070
llvm-svn: 357283
2019-03-30 01:35:56 +08:00
|
|
|
; ALL-NEXT: pcmpeqd %xmm1, %xmm1
|
|
|
|
; ALL-NEXT: pxor %xmm1, %xmm0
|
2017-05-13 04:53:48 +08:00
|
|
|
; ALL-NEXT: psrld $31, %xmm0
|
|
|
|
; ALL-NEXT: retq
|
|
|
|
%sh = lshr <4 x i32> %x, <i32 31, i32 31, i32 31, i32 31>
|
|
|
|
%not = xor <4 x i32> %sh, <i32 -1, i32 -1, i32 -1, i32 -1>
|
|
|
|
%and = and <4 x i32> %not, <i32 1, i32 1, i32 1, i32 1>
|
|
|
|
ret <4 x i32> %and
|
|
|
|
}
|
|
|
|
|
2016-12-03 01:48:48 +08:00
|
|
|
; Clear low bits via shift, set them with xor (not), then mask them off.
|
|
|
|
|
|
|
|
define i8 @shrink_xor_constant2(i8 %x) {
|
2016-12-03 01:58:26 +08:00
|
|
|
; ALL-LABEL: shrink_xor_constant2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0:
|
2016-12-03 01:58:26 +08:00
|
|
|
; ALL-NEXT: movl %edi, %eax
|
2018-11-23 03:24:10 +08:00
|
|
|
; ALL-NEXT: notb %al
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: shlb $5, %al
|
|
|
|
; ALL-NEXT: # kill: def $al killed $al killed $eax
|
2016-12-03 01:58:26 +08:00
|
|
|
; ALL-NEXT: retq
|
2016-12-03 01:48:48 +08:00
|
|
|
%sh = shl i8 %x, 5
|
|
|
|
%not = xor i8 %sh, -1
|
|
|
|
%and = and i8 %not, 224 ; 0xE0
|
|
|
|
ret i8 %and
|
|
|
|
}
|
|
|
|
|
2017-05-13 04:53:48 +08:00
|
|
|
define <16 x i8> @shrink_xor_constant2_splat(<16 x i8> %x) {
|
|
|
|
; ALL-LABEL: shrink_xor_constant2_splat:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0:
|
2017-09-26 03:26:08 +08:00
|
|
|
; ALL-NEXT: movaps {{.*#+}} xmm0 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
|
2017-05-13 04:53:48 +08:00
|
|
|
; ALL-NEXT: retq
|
|
|
|
%sh = shl <16 x i8> %x, <i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5>
|
|
|
|
%not = xor <16 x i8> %sh, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
|
|
|
|
%and = and <16 x i8> %not, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
|
|
|
|
ret <16 x i8> %and
|
|
|
|
}
|
|
|
|
|