changeset 14975:95bfd032f4c7

Add element wise boolean And and Or in JIT
author Max Brister <max@2bass.com>
date Wed, 27 Jun 2012 15:49:28 -0500
parents e3cd4c9d7ccc
children 2d7c0c86e712
files src/pt-jit.cc
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/pt-jit.cc	Wed Jun 27 14:14:20 2012 -0500
+++ b/src/pt-jit.cc	Wed Jun 27 15:49:28 2012 -0500
@@ -613,6 +613,10 @@
   // now for binary index operators
   add_binary_op (index, octave_value::op_add, llvm::Instruction::Add);
 
+  // and binary bool operators
+  add_binary_op (boolean, octave_value::op_el_or, llvm::Instruction::Or);
+  add_binary_op (boolean, octave_value::op_el_and, llvm::Instruction::And);
+
   // now for printing functions
   print_fn.stash_name ("print");
   add_print (any, reinterpret_cast<void*> (&octave_jit_print_any));
@@ -1880,9 +1884,9 @@
 void
 jit_convert::visit_binary_expression (tree_binary_expression& be)
 {
+  // this is the case for bool_or and bool_and
   if (be.op_type () >= octave_value::num_binary_ops)
-    // this is the case for bool_or and bool_and
-    fail ();
+    fail ("Unsupported binary operator");
 
   tree_expression *lhs = be.lhs ();
   jit_value *lhsv = visit (lhs);