http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52584
Bug #: 52584 Summary: Fails to constant fold vector upper/lower half BIT_FIELD_REFs Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: middle-end AssignedTo: rgue...@gcc.gnu.org ReportedBy: rgue...@gcc.gnu.org Target: x86_64-*-* int main() { int a = 1; typedef int v4si __attribute__ ((vector_size (8 * sizeof(int)))); v4si x; v4si y; y = x + a; foo(y); return 0; } shows a missed optimization in how we fold BIT_FIELD_REFs that select the upper/lower part of a vector: <bb 2>: D.1719_9 = BIT_FIELD_REF <x_4(D), 128, 0>; D.1721_10 = BIT_FIELD_REF <{ 1, 1, 1, 1, 1, 1, 1, 1 }, 128, 0>; D.1722_11 = D.1719_9 + D.1721_10; D.1723_12 = BIT_FIELD_REF <x_4(D), 128, 128>; D.1725_13 = BIT_FIELD_REF <{ 1, 1, 1, 1, 1, 1, 1, 1 }, 128, 128>; D.1726_14 = D.1723_12 + D.1725_13; y_5 = {D.1722_11, D.1726_14}; foo (y_5); return 0; we should have constant-folded D.1721_10 and D.1725_13.