public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/44659] New: Combiner fails to match cmp patterns with upper 8bit register
@ 2010-06-24 17:56 hjl dot tools at gmail dot com
2010-06-24 22:41 ` [Bug rtl-optimization/44659] Combiner fails to match QI " hjl dot tools at gmail dot com
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-06-24 17:56 UTC (permalink / raw)
To: gcc-bugs
After fixing PR 44588, I got
[hjl@gnu-6 divb]$ cat umod-4.c
int
foo (unsigned char x, unsigned char y)
{
return (x % y) != 0;
}
[hjl@gnu-6 divb]$ /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -Os -c -o umod-4.o umod-4.c
[hjl@gnu-6 divb]$ cat umod-4.s
.file "umod-4.c"
.text
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
movzbl %dil, %eax
divb %sil
movzbl %ah, %eax
testb %al, %al
setne %al
movzbl %al, %eax
ret
We can generate
testb %ah, %ah
instead of
movzbl %ah, %eax
testb %al, %al
The combine pass shows
Trying 11 -> 13:
Failed to match this instruction:
(set (reg:CCZ 17 flags)
(compare:CCZ (subreg:QI (lshiftrt:SI (subreg:SI (reg:HI 69) 0)
(const_int 8 [0x8])) 0)
(const_int 0 [0])))
with
(insn 11 10 13 2 umod-4.c:4 (set (reg:QI 67)
(subreg:QI (zero_extract:SI (reg:HI 69)
(const_int 8 [0x8])
(const_int 8 [0x8])) 0)) 90 {*movqi_extzv_2_rex64}
(expr_list:REG_DEAD (reg:HI 69)
(expr_list:REG_EQUAL (umod:QI (reg/v:QI 61 [ x ])
(reg/v:QI 63 [ y ]))
(nil))))
(insn 13 11 14 2 umod-4.c:4 (set (reg:CCZ 17 flags)
(compare:CCZ (reg:QI 67)
(const_int 0 [0]))) 0 {*cmpqi_ccno_1} (expr_list:REG_DEAD (reg:QI
67)
(nil)))
i386.md has
(define_insn "*cmpqi_ext_2"
[(set (reg FLAGS_REG)
(compare
(subreg:QI
(zero_extract:SI
(match_operand 0 "ext_register_operand" "Q")
(const_int 8)
(const_int 8)) 0)
(match_operand:QI 1 "const0_operand" "")))]
"ix86_match_ccmode (insn, CCNOmode)"
"test{b}\t%h0, %h0"
[(set_attr "type" "test")
(set_attr "length_immediate" "0")
(set_attr "mode" "QI")])
According to
http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02477.html
(set (reg:CCZ 17 flags)
(compare:CCZ (subreg:QI (lshiftrt:SI (subreg:SI (reg:HI 69) 0)
(const_int 8 [0x8])) 0)
(const_int 0 [0])))
is the standard form within combine.c. The questions are
1. Why doesn't combiner match QI cmp patterns with zero_extract?
2. Should i386.md provide QI cmp patterns with lshiftrt for
combiner?
3. Does i386.md need QI cmp patterns with zero_extract if they aren't
used by combiner?
--
Summary: Combiner fails to match cmp patterns with upper 8bit
register
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hjl dot tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44659
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/44659] Combiner fails to match QI cmp patterns with upper 8bit register
2010-06-24 17:56 [Bug target/44659] New: Combiner fails to match cmp patterns with upper 8bit register hjl dot tools at gmail dot com
@ 2010-06-24 22:41 ` hjl dot tools at gmail dot com
2010-06-24 22:43 ` hjl dot tools at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-06-24 22:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from hjl dot tools at gmail dot com 2010-06-24 22:41 -------
X86 backend has special support for
(zero_extract:SI (reg:M N) (const_int 8) (const_int 8))
If backend provides zero_extract, shouldn't we preserve it?
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |rtl-optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44659
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/44659] Combiner fails to match QI cmp patterns with upper 8bit register
2010-06-24 17:56 [Bug target/44659] New: Combiner fails to match cmp patterns with upper 8bit register hjl dot tools at gmail dot com
2010-06-24 22:41 ` [Bug rtl-optimization/44659] Combiner fails to match QI " hjl dot tools at gmail dot com
@ 2010-06-24 22:43 ` hjl dot tools at gmail dot com
2010-06-25 16:44 ` hjl dot tools at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-06-24 22:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from hjl dot tools at gmail dot com 2010-06-24 22:43 -------
Created an attachment (id=20999)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20999&action=view)
A patch
With this patch, I got
[hjl@gnu-6 divb]$ cat umod-4.c
int
foo (unsigned char x, unsigned char y)
{
return (x % y) != 0;
}
[hjl@gnu-6 divb]$ make umod-4.s
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -Os -S umod-4.c
[hjl@gnu-6 divb]$ cat umod-4.s
.file "umod-4.c"
.text
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
movzbl %dil, %eax
divb %sil
testw $-256, %ax
setne %al
movzbl %al, %eax
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44659
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/44659] Combiner fails to match QI cmp patterns with upper 8bit register
2010-06-24 17:56 [Bug target/44659] New: Combiner fails to match cmp patterns with upper 8bit register hjl dot tools at gmail dot com
2010-06-24 22:41 ` [Bug rtl-optimization/44659] Combiner fails to match QI " hjl dot tools at gmail dot com
2010-06-24 22:43 ` hjl dot tools at gmail dot com
@ 2010-06-25 16:44 ` hjl dot tools at gmail dot com
2010-06-29 9:25 ` ebotcazou at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-06-25 16:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from hjl dot tools at gmail dot com 2010-06-25 16:43 -------
Another testcase:
[hjl@gnu-6 44659]$ cat extract-3.c
typedef struct
{
unsigned char c1;
unsigned char c2;
unsigned char c3;
unsigned char c4;
} foo_t;
int
foo (foo_t x)
{
return x.c2 != 0;
}
[hjl@gnu-6 44659]$ make extract-3.s
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -Os -S extract-3.c
[hjl@gnu-6 44659]$ cat extract-3.s
.file "extract-3.c"
.text
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
movl %edi, %eax
movzbl %ah, %edi
xorl %eax, %eax
testb %dil, %dil
setne %al
ret
movzbl %ah, %edi
testb %dil, %dil
can be combined into one instruction.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44659
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/44659] Combiner fails to match QI cmp patterns with upper 8bit register
2010-06-24 17:56 [Bug target/44659] New: Combiner fails to match cmp patterns with upper 8bit register hjl dot tools at gmail dot com
` (3 preceding siblings ...)
2010-06-29 9:25 ` ebotcazou at gcc dot gnu dot org
@ 2010-06-29 9:25 ` ebotcazou at gcc dot gnu dot org
2010-07-09 10:27 ` ebotcazou at gcc dot gnu dot org
2010-07-10 15:35 ` hjl at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2010-06-29 9:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from ebotcazou at gcc dot gnu dot org 2010-06-29 09:24 -------
Subject: Bug 44659
Author: ebotcazou
Date: Tue Jun 29 09:24:34 2010
New Revision: 161523
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161523
Log:
PR rtl-optimization/44659
* combine.c (make_compound_operation) <SUBREG>: Do not return the
result of force_to_mode if it partially re-expanded the compound.
Added:
trunk/gcc/testsuite/gcc.target/i386/extract-1.c
trunk/gcc/testsuite/gcc.target/i386/extract-2.c
trunk/gcc/testsuite/gcc.target/i386/extract-3.c
trunk/gcc/testsuite/gcc.target/i386/extract-4.c
trunk/gcc/testsuite/gcc.target/i386/extract-5.c
trunk/gcc/testsuite/gcc.target/i386/extract-6.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44659
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/44659] Combiner fails to match QI cmp patterns with upper 8bit register
2010-06-24 17:56 [Bug target/44659] New: Combiner fails to match cmp patterns with upper 8bit register hjl dot tools at gmail dot com
` (2 preceding siblings ...)
2010-06-25 16:44 ` hjl dot tools at gmail dot com
@ 2010-06-29 9:25 ` ebotcazou at gcc dot gnu dot org
2010-06-29 9:25 ` ebotcazou at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2010-06-29 9:25 UTC (permalink / raw)
To: gcc-bugs
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-06-29 09:24:50
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44659
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/44659] Combiner fails to match QI cmp patterns with upper 8bit register
2010-06-24 17:56 [Bug target/44659] New: Combiner fails to match cmp patterns with upper 8bit register hjl dot tools at gmail dot com
` (4 preceding siblings ...)
2010-06-29 9:25 ` ebotcazou at gcc dot gnu dot org
@ 2010-07-09 10:27 ` ebotcazou at gcc dot gnu dot org
2010-07-10 15:35 ` hjl at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2010-07-09 10:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from ebotcazou at gcc dot gnu dot org 2010-07-09 10:27 -------
.
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.6.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44659
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/44659] Combiner fails to match QI cmp patterns with upper 8bit register
2010-06-24 17:56 [Bug target/44659] New: Combiner fails to match cmp patterns with upper 8bit register hjl dot tools at gmail dot com
` (5 preceding siblings ...)
2010-07-09 10:27 ` ebotcazou at gcc dot gnu dot org
@ 2010-07-10 15:35 ` hjl at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: hjl at gcc dot gnu dot org @ 2010-07-10 15:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from hjl at gcc dot gnu dot org 2010-07-10 15:35 -------
Subject: Bug 44659
Author: hjl
Date: Sat Jul 10 15:35:04 2010
New Revision: 162040
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162040
Log:
Fix combine to match QI cmp patterns with upper 8bit register.
gcc/
2010-07-09 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline
2010-06-29 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/44659
* combine.c (make_compound_operation) <SUBREG>: Do not return the
result of force_to_mode if it partially re-expanded the compound.
gcc/testsuite/
2010-07-09 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline
2010-06-29 H.J. Lu <hongjiu.lu@intel.com>
PR rtl-optimization/44659
* gcc.target/i386/extract-1.c: New.
* gcc.target/i386/extract-2.c: Likewise.
* gcc.target/i386/extract-3.c: Likewise.
* gcc.target/i386/extract-4.c: Likewise.
* gcc.target/i386/extract-5.c: Likewise.
* gcc.target/i386/extract-6.c: Likewise.
Added:
branches/ix86/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/extract-1.c
branches/ix86/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/extract-2.c
branches/ix86/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/extract-3.c
branches/ix86/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/extract-4.c
branches/ix86/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/extract-5.c
branches/ix86/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/extract-6.c
Modified:
branches/ix86/gcc-4_5-branch/gcc/ChangeLog.ix86
branches/ix86/gcc-4_5-branch/gcc/combine.c
branches/ix86/gcc-4_5-branch/gcc/testsuite/ChangeLog.ix86
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44659
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-07-10 15:35 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-24 17:56 [Bug target/44659] New: Combiner fails to match cmp patterns with upper 8bit register hjl dot tools at gmail dot com
2010-06-24 22:41 ` [Bug rtl-optimization/44659] Combiner fails to match QI " hjl dot tools at gmail dot com
2010-06-24 22:43 ` hjl dot tools at gmail dot com
2010-06-25 16:44 ` hjl dot tools at gmail dot com
2010-06-29 9:25 ` ebotcazou at gcc dot gnu dot org
2010-06-29 9:25 ` ebotcazou at gcc dot gnu dot org
2010-07-09 10:27 ` ebotcazou at gcc dot gnu dot org
2010-07-10 15:35 ` hjl at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).