[PATCH] Fix checked arithmetic for i8 on X86
Andrea Di Biagio
Andrea_DiBiagio at sn.scee.net
Tue May 27 10:15:07 PDT 2014
Hi Keno,
Thanks for the patch.
Can you add a test for it? I think you can probably reuse the example you posted on the bugzilla to verify that we correctly test and branch.
================
Comment at: lib/Target/X86/X86ISelLowering.cpp:11472-11474
@@ -11471,3 +11471,5 @@
if (addTest) {
- CC = DAG.getConstant(X86::COND_NE, MVT::i8);
- Cond = EmitTest(Cond, X86::COND_NE, dl, DAG);
+ X86::CondCode X86Cond = X86::COND_NE;
+ if (Inverted)
+ X86Cond = X86::GetOppositeBranchCondition((X86::CondCode)X86Cond);
+ CC = DAG.getConstant(X86Cond, MVT::i8);
----------------
You can simplify this into:
X86::CondCode X86Cond = Inverted ? X86::COND_E : X86::COND_NE;
http://reviews.llvm.org/D3920
More information about the llvm-commits
mailing list