From d8502c2aa9f0917c49056ea3ffba2c2569666873 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Wed, 6 Aug 2014 09:01:36 -0700 Subject: [PATCH] Trap without fragmenting blocks. --- src/alloy/frontend/ppc/ppc_emit_control.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/alloy/frontend/ppc/ppc_emit_control.cc b/src/alloy/frontend/ppc/ppc_emit_control.cc index 5b409eaa4..dc8c11c3a 100644 --- a/src/alloy/frontend/ppc/ppc_emit_control.cc +++ b/src/alloy/frontend/ppc/ppc_emit_control.cc @@ -436,25 +436,34 @@ int InstrEmit_trap(PPCHIRBuilder& f, InstrData& i, Value* va, Value* vb, if (!TO) { return 0; } + Value* v = nullptr; if (TO & (1 << 4)) { // a < b - f.TrapTrue(f.CompareSLT(va, vb)); + auto cmp = f.CompareSLT(va, vb); + v = v ? f.Or(v, cmp) : cmp; } if (TO & (1 << 3)) { // a > b - f.TrapTrue(f.CompareSGT(va, vb)); + auto cmp = f.CompareSGT(va, vb); + v = v ? f.Or(v, cmp) : cmp; } if (TO & (1 << 2)) { // a = b - f.TrapTrue(f.CompareEQ(va, vb)); + auto cmp = f.CompareEQ(va, vb); + v = v ? f.Or(v, cmp) : cmp; } if (TO & (1 << 1)) { // a u b - f.TrapTrue(f.CompareUGT(va, vb)); + auto cmp = f.CompareUGT(va, vb); + v = v ? f.Or(v, cmp) : cmp; + } + if (v) { + f.TrapTrue(v); } return 0; }