https://bugs.llvm.org/show_bug.cgi?id=35765

            Bug ID: 35765
           Summary: "X86 DAG->DAG Instruction Selection on function"
                    triggers wrong code
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: babo...@gmail.com
                CC: llvm-bugs@lists.llvm.org

clang trunk, x86_64, rev321482

> cat f.cpp
struct S {
    unsigned short m : 11;
};
long long int ll;
S s1 = { 1403 };
long long int x = 2651237805702985558L;
S s2 = { 902 };


void foo() {
  ll = (4 << (s1.m - 1398)) ^ (unsigned short)(x | ~s2.m);
}

int main() {
    foo();
    __builtin_printf("%lld\n", ll);
    return 0;
}

> clang++ f.cpp -std=c++11 -o out -O0; ./out
65535
> clang++ f.cpp -std=c++11 -o out -O2; ./out
-1

clang 5.0 produces correct result, so this is regression.

-- 
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

Reply via email to