Skip to content

Commit 3c25b3e

Browse files
committed
[X86] Return true for opaque constants in hasAndNotCompare.
This is the X86 equivalent of llvm#92926
1 parent 2805e6f commit 3c25b3e

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3292,7 +3292,7 @@ bool X86TargetLowering::hasAndNotCompare(SDValue Y) const {
32923292
if (VT != MVT::i32 && VT != MVT::i64)
32933293
return false;
32943294

3295-
return !isa<ConstantSDNode>(Y);
3295+
return !isa<ConstantSDNode>(Y) || cast<ConstantSDNode>(Y)->isOpaque();
32963296
}
32973297

32983298
bool X86TargetLowering::hasAndNot(SDValue Y) const {

llvm/test/CodeGen/X86/pr90703.ll

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+bmi | FileCheck %s
3+
4+
define i64 @pr90730(i64 %x, i64 %y, ptr %p) {
5+
; CHECK-LABEL: pr90730:
6+
; CHECK: # %bb.0: # %entry
7+
; CHECK-NEXT: movabsq $33181731808, %rax # imm = 0x7B9C90BE0
8+
; CHECK-NEXT: andnq %rax, %rdi, %rax
9+
; CHECK-NEXT: movq $0, (%rdx)
10+
; CHECK-NEXT: retq
11+
entry:
12+
%ext = and i64 %y, 1
13+
%xor1 = xor i64 %ext, 33181731817
14+
%and1 = and i64 %xor1, %x
15+
store i64 %and1, ptr %p, align 4
16+
%v = load i64, ptr %p, align 4
17+
%and2 = and i64 %v, 33181731808
18+
%xor2 = xor i64 %and2, 33181731808
19+
store i64 0, ptr %p, align 4
20+
ret i64 %xor2
21+
}

0 commit comments

Comments
 (0)