LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 945 - x86 backend doesn't lower x%255 to multiply
Summary: x86 backend doesn't lower x%255 to multiply
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: 1.0
Hardware: All All
: P normal
Assignee: Chris Lattner
URL:
Keywords: code-quality
Depends on:
Blocks:
 
Reported: 2006-10-12 01:42 PDT by Chris Lattner
Modified: 2010-02-22 12:49 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lattner 2006-10-12 01:42:41 PDT
Consider:

int test(int X) {
  return X%255;
}

The PPC backend lowers this to mulhw+stuff, the X86 backend should too.  It is the major reason we are 
slower at Benchmarks/Misc/ReedSolomon.c than GCC.

-Chris
Comment 1 Chris Lattner 2006-10-12 16:00:22 PDT
Fixed.  Patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061009/038537.html

Testcase here: Regression/CodeGen/X86/rem.ll

llc is now faster than GCC on reedsolomon.c.

-Chris