}
assert(LLVMIsDeclaration(function));
+#ifdef DEBUG
+ /* We shouldn't use only constants with intrinsics, as they won't be
+ * propagated by LLVM optimization passes.
+ */
+ if(LLVMIsConstant(a) && LLVMIsConstant(b))
+ debug_printf("warning: invoking intrinsic \"%s\" with constants\n");
+#endif
+
args[0] = a;
args[1] = b;
if(a == bld->undef || b == bld->undef)
return bld->undef;
+ if(a == b)
+ return a;
+
if(bld->type.norm) {
if(a == bld->zero || b == bld->zero)
return bld->zero;
if(a == bld->undef || b == bld->undef)
return bld->undef;
+ if(a == b)
+ return a;
+
if(bld->type.norm) {
if(a == bld->one || b == bld->one)
return bld->one;