-flegacy-vector-maths, enabled by default
authorWolfgang Bumiller <blub@speed.at>
Mon, 14 Jan 2013 10:15:06 +0000 (11:15 +0100)
committerWolfgang Bumiller <blub@speed.at>
Mon, 14 Jan 2013 10:15:06 +0000 (11:15 +0100)
ir.c
opts.c
opts.def

diff --git a/ir.c b/ir.c
index 7bfd43f9386ab87595bb8f34b52dabcece0f3e7c..4c41c8c478e82532395d354b10fab01687723c95 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -600,6 +600,13 @@ bool ir_function_pass_peephole(ir_function *self)
                 if (!instr_is_operation(oper->opcode))
                     continue;
 
+                if (OPTS_FLAG(LEGACY_VECTOR_MATHS)) {
+                    if (oper->opcode == INSTR_MUL_VF && oper->_ops[2]->memberof == oper->_ops[1])
+                        continue;
+                    if (oper->opcode == INSTR_MUL_FV && oper->_ops[1]->memberof == oper->_ops[2])
+                        continue;
+                }
+
                 value = oper->_ops[0];
 
                 /* only do it for SSA values */
diff --git a/opts.c b/opts.c
index 0c8d3f4c2de1bc7b561777e12fa35484b00441a6..beef91aeb7d9a5dfb401fcfbd35047b29482ba92 100644 (file)
--- a/opts.c
+++ b/opts.c
@@ -66,6 +66,7 @@ static void opts_setdefault() {
     opts_set(opts.flags, FTEPP_PREDEFS,                  false);
     opts_set(opts.flags, CORRECT_TERNARY,                true);
     opts_set(opts.flags, BAIL_ON_WERROR,                 true);
+    opts_set(opts.flags, LEGACY_VECTOR_MATHS,            true);
 }
 
 void opts_backup_non_Wall() {
index 16ef9d521845137ac2af538f9a5ba3bfa221417c..bde5e48eb0502e139e2d8330e67a022504501dfe 100644 (file)
--- a/opts.def
+++ b/opts.def
@@ -49,6 +49,7 @@
     GMQCC_DEFINE_FLAG(UNTYPED_NIL)
     GMQCC_DEFINE_FLAG(PERMISSIVE)
     GMQCC_DEFINE_FLAG(VARIADIC_ARGS)
+    GMQCC_DEFINE_FLAG(LEGACY_VECTOR_MATHS)
 #endif
 
 /* warning flags */