Files
clang-p2996/llvm/test/CodeGen/X86/pr90668.ll
Craig Topper a03eeb0e98 [SelectionDAG][X86] Add a NoWrap flag to SelectionDAG::isAddLike. NFC (#90681)
If this flag is set, Xor will not be considered AddLike. If an Xor were
treated as an Add it may wrap. If we can prove there would be no carry out and
thus no wrap, the Xor would be turned into a disjoint Or by DAGCombine.

Use this new flag to fix a bug in X86 where an Xor is incorrectly being treated
as an NUWAdd.

Fixes #90668.
2024-04-30 16:52:56 -07:00

17 lines
481 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s
define i64 @off(i8 signext %a) {
; CHECK-LABEL: off:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: addb $-128, %dil
; CHECK-NEXT: movzbl %dil, %eax
; CHECK-NEXT: shll $3, %eax
; CHECK-NEXT: retq
entry:
%add = xor i8 %a, -128
%conv2 = zext i8 %add to i64
%mul = shl nuw nsw i64 %conv2, 3
ret i64 %mul
}