This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [rfc] multi-word subreg lowering pass
- From: Chris Lattner <sabre at nondot dot org>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Bjrn Haase <bjoern dot m dot haase at web dot de>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 6 May 2005 22:51:47 -0500 (CDT)
- Subject: RE: [rfc] multi-word subreg lowering pass
Richard Henderson wrote:
If the target leaves logical arithmetic to the middle end, this
means that the posted example,
long long foo(int x, long long y) {
return x & y;
}
will decompose to
(set (reg:SI 100) (reg:SI x))
(set (reg:SI 101) (const_int 0))
(set (reg:SI 102) (and:SI (reg:SI 100) (reg:SI ylow)))
(set (reg:SI 103) (and:SI (reg:SI 101) (reg:SI yhigh)))
(set (reg:SI eax) (reg:SI 102))
(set (reg:SI edx) (reg:SI 103))
Are you sure? This isn't correct. The input value is sign extended.
LLVM produces this:
foo:
movl 4(%esp), %eax
movl %eax, %edx
sarl $31, %edx
andl 12(%esp), %edx
andl 8(%esp), %eax
ret
I don't think there is any way to get rid of the sar or the second and for
this example. If the first arg is changed to unsigned, I get this:
foo:
movl 8(%esp), %eax
andl 4(%esp), %eax
movl $0, %edx
ret
Is this the case you mean?
-Chris
--
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/