https://llvm.org/bugs/show_bug.cgi?id=25852
Bug ID: 25852 Summary: operation on bit-fields shall yield results reduced to bit-field size Product: clang Version: 3.7 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Frontend Assignee: unassignedclangb...@nondot.org Reporter: konstantin.vladimi...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Created attachment 15468 --> https://llvm.org/bugs/attachment.cgi?id=15468&action=edit bitfield reproduction The test (attached) is taken from gcc dejagnu and minimized. Clang 3.7 yields: %bf.load = load i64, i64* bitcast ({ i8, i8, i8, i8, i8, [3 x i8], i8, i8, i8, i8, i8, [3 x i8], i8, i8, i8, i8, i8, i8, [2 x i8] }* @a to i64*), align 8 %bf.clear = and i64 %bf.load, 8589934591 %mul = mul i64 %bf.clear, %bf.clear %cmp = icmp eq i64 %mul, 0 br i1 %cmp, label %if.end, label %if.then But after multiplication result should be casted to bitfield type, i.e. 33-bit. Compare to GCC gimple: <unnamed-unsigned:33> D.2209D.2209; <unnamed-unsigned:33> D.2208D.2208; <bb 2>: D.2208D.2208_1 = a.u33; D.2208D.2208_2 = a.u33; D.2209D.2209_3 = D.2208D.2208_2 * D.2208D.2208_2; if (D.2209D.2209_3 != 0) goto <bb 3>; else goto <bb 4>; Which is correct. Please fix this. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs