return;
*op1 = GEN_INT (i + 1);
*code = *code == GT ? GE : LT;
- return;
}
- break;
+ else
+ {
+ /* GT maxval is always false, LE maxval is always true.
+ We can't fold that away here as we must make a
+ comparison, but we can fold them to comparisons
+ with the same result that can be handled:
+ op0 GT maxval -> op0 LT minval
+ op0 LE maxval -> op0 GE minval
+ where minval = (-maxval - 1). */
+ *op1 = GEN_INT (-maxval - 1);
+ *code = *code == GT ? LT : GE;
+ }
+ return;
case GTU:
case LEU:
return;
*op1 = GEN_INT (i + 1);
*code = *code == GTU ? GEU : LTU;
- return;
}
- break;
+ else
+ {
+ /* GTU ~0 is always false, LEU ~0 is always true.
+ We can't fold that away here as we must make a
+ comparison, but we can fold them to comparisons
+ with the same result that can be handled:
+ op0 GTU ~0 -> op0 LTU 0
+ op0 LEU ~0 -> op0 GEU 0. */
+ *op1 = const0_rtx;
+ *code = *code == GTU ? LTU : GEU;
+ }
+ return;
default:
gcc_unreachable ();
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Og" } */
+unsigned long long e(void);
+void f(int);
+void a() {
+ short b = -1, c = (int)&b;
+ unsigned long long d = e();
+ f(b >= d);
+}