From 60c5bef90f5741312545c1d2e27f9d36577bf37b Mon Sep 17 00:00:00 2001 From: "james.brodman" Date: Wed, 15 May 2013 16:57:41 -0400 Subject: [PATCH] Simplify ~mask codegen to emit single XOR like other places in the code. --- ctx.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ctx.cpp b/ctx.cpp index 9f7c3bfb..872751eb 100644 --- a/ctx.cpp +++ b/ctx.cpp @@ -553,8 +553,10 @@ FunctionEmitContext::EndIf() { breakLanes, "|break_lanes"); } - llvm::Value *notBreakOrContinue = - NotOperator(bcLanes, "!(break|continue)_lanes"); + llvm::Value *notBreakOrContinue = + BinaryOperator(llvm::Instruction::Xor, + bcLanes, LLVMMaskAllOn, + "!(break|continue)_lanes"); llvm::Value *oldMask = GetInternalMask(); llvm::Value *newMask = BinaryOperator(llvm::Instruction::And, oldMask, @@ -659,7 +661,9 @@ FunctionEmitContext::restoreMaskGivenReturns(llvm::Value *oldMask) { // newMask = (oldMask & ~returnedLanes) llvm::Value *returnedLanes = LoadInst(returnedLanesPtr, "returned_lanes"); - llvm::Value *notReturned = NotOperator(returnedLanes, "~returned_lanes"); + llvm::Value *notReturned = BinaryOperator(llvm::Instruction::Xor, + returnedLanes, LLVMMaskAllOn, + "~returned_lanes"); llvm::Value *newMask = BinaryOperator(llvm::Instruction::And, oldMask, notReturned, "new_mask"); SetInternalMask(newMask);