We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The X86 backend produces significantly slower (2.5x) code for the quantum_toffoli than the C backend.
Code layout seems to be a major contributing factor, but also there are a number of 64-bit shifts that we may be codegen'ing poorly or something.
-Chris
The text was updated successfully, but these errors were encountered:
Here's a C testcase:
void test(int control1, int control2, int target, long long *reg, int *numreg) { int i; for(i=0; i < numreg; i++) if(reg[i] & ((long long) 1 << control1)) if(reg[i] & ((long long) 1 << control2)) reg[i] ^= ((long long) 1 << target); }
Sorry, something went wrong.
The code layout issues have been fixed with an llvm-gcc patch.
The next major issue is that instcombine is turning things like:
if (reg[i] & ((long long) 1 << control1))
into: if ((reg[i] >> control1) & 1))
This is bad because it makes the (expensive) shift no longer be loop invariant.
Also, it would be much better to compile the code to something like this:
long long tmp1 = ((long long) 1 << target); long long tmp2 = ((long long) 1 << control1) & ((long long) 1 << control2); for(i=0; i < *numreg; i++) if(reg[i] & tmp2) reg[i] ^= tmp1;
Actually, it turns out the CFE is the one doing that transformation.
The code layout and instcombine issues are now fixed, 462.libquantum is now 16% faster with llc than with gcc.
No branches or pull requests
Extended Description
The X86 backend produces significantly slower (2.5x) code for the quantum_toffoli than the C backend.
Code layout seems to be a major contributing factor, but also there are a number of 64-bit shifts that we
may be codegen'ing poorly or something.
-Chris
The text was updated successfully, but these errors were encountered: