Skip to content

Commit 6e5bffb

Browse files
committed
[M68k] Fix backwards BTST condition
1 parent 77cb098 commit 6e5bffb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Target/M68k/M68kISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,8 +1667,8 @@ static SDValue getBitTestCondition(SDValue Src, SDValue BitNo, ISD::CondCode CC,
16671667

16681668
SDValue BTST = DAG.getNode(M68kISD::BTST, DL, MVT::i32, Src, BitNo);
16691669

1670-
// NOTE BTST sets CCR.Z flag
1671-
M68k::CondCode Cond = CC == ISD::SETEQ ? M68k::COND_NE : M68k::COND_EQ;
1670+
// NOTE BTST sets CCR.Z flag if bit is 0, same as AND with bitmask
1671+
M68k::CondCode Cond = CC == ISD::SETEQ ? M68k::COND_EQ : M68k::COND_NE;
16721672
return DAG.getNode(M68kISD::SETCC, DL, MVT::i8,
16731673
DAG.getConstant(Cond, DL, MVT::i8), BTST);
16741674
}

0 commit comments

Comments
 (0)