* Bit fields
@ 2009-08-31 20:07 Jean Christophe Beyler
2009-08-31 20:36 ` Ian Lance Taylor
0 siblings, 1 reply; 7+ messages in thread
From: Jean Christophe Beyler @ 2009-08-31 20:07 UTC (permalink / raw)
To: gcc
Dear all,
I am currently working on handling bit-fields on my port and am having
difficulties understanding why GCC is having problems with what I
wrote in.
Following what mips did:
(define_expand "extzv"
[(set (match_operand 0 "register_operand")
(zero_extract (match_operand 1 "nonimmediate_operand")
(match_operand 2 "immediate_operand")
(match_operand 3 "immediate_operand")))]
"!TARGET_MIPS16"
{
...
})
(define_insn "extzv<mode>"
[(set (match_operand:GPR 0 "register_operand" "=d")
(zero_extract:GPR (match_operand:GPR 1 "register_operand" "d")
(match_operand:SI 2 "immediate_operand" "I")
(match_operand:SI 3 "immediate_operand" "I")))]
"mips_use_ins_ext_p (operands[1], INTVAL (operands[2]),INTVAL (operands[3]))"
"<d>ext\t%0,%1,%3,%2"
[(set_attr "type" "arith")
(set_attr "mode" "<MODE>")])
I did:
(define_insn "extzv"
[(set (match_operand 0 "register_operand" "")
(zero_extract (match_operand 1 "register_operand" "")
(match_operand 2 "const_int_operand" "")
(match_operand 3 "const_int_operand" "")))]
""
"")
(define_insn "extzvdi2"
[(set (match_operand:DI 0 "register_operand" "=r")
(zero_extract:DI (match_operand:DI 1 "register_operand" "r")
(match_operand:DI 2 "const_int_operand" "L")
(match_operand:DI 3 "const_int_operand" "L")))]
"check_extract (DImode, DImode, operands[2], operands[2])"
"extr\\t%0,%1,%3,%2";
[(set_attr "type" "arith")
(set_attr "mode" "DI")
(set_attr "length" "1")])
For the moment, I haven't put anything in my expand because I don't
know if anything is necessary yet. I was first looking at if GCC was
generating the right code on simple examples.
But I get this message:
struct4.c: In function 'goo':
struct4.c:32: internal compiler error: in simplify_subreg, at
simplify-rtx.c:4923
Does anybody know how can I solve this issue ?
Thanks again for all your help,
Jean Christophe Beyler
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bit fields
2009-08-31 20:07 Bit fields Jean Christophe Beyler
@ 2009-08-31 20:36 ` Ian Lance Taylor
2009-08-31 21:27 ` Jean Christophe Beyler
0 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2009-08-31 20:36 UTC (permalink / raw)
To: Jean Christophe Beyler; +Cc: gcc
Jean Christophe Beyler <jean.christophe.beyler@gmail.com> writes:
> But I get this message:
> struct4.c: In function 'goo':
> struct4.c:32: internal compiler error: in simplify_subreg, at
> simplify-rtx.c:4923
>
> Does anybody know how can I solve this issue ?
You need to start by looking at line 4923 of simplify-rtx.c to see what
the failure is. We don't know, since we don't have your source and you
didn't mention which version of gcc you are using.
I don't see anything obviously wrong in your example, but there were
many omitted details which could have caused this problem.
Ian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bit fields
2009-08-31 20:36 ` Ian Lance Taylor
@ 2009-08-31 21:27 ` Jean Christophe Beyler
2009-08-31 21:53 ` Richard Henderson
0 siblings, 1 reply; 7+ messages in thread
From: Jean Christophe Beyler @ 2009-08-31 21:27 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc
Sorry, you are correct. That line is the :
gcc_assert (outermode != VOIDmode);
of the simplify_subreg function.
However, I've played around with it and saw that I made a mistake when
writing up this question, I simplified what I had put in my MD file,
and actually made a mistake. I apologize.
If I replace this :
(define_insn "extzv"
[(set (match_operand 0 "register_operand" "")
(zero_extract (match_operand 1 "register_operand" "")
(match_operand 2 "const_int_operand" "")
(match_operand 3 "const_int_operand" "")))]
""
"")
into :
(define_expand "extzv"
[(set (match_operand 0 "register_operand" "")
(zero_extract (match_operand 1 "register_operand" "")
(match_operand 2 "const_int_operand" "")
(match_operand 3 "const_int_operand" "")))]
""
"")
I do not get any errors. I don't know if it's handled but it seems to
no longer have issues anymore.
However, if I consider this code:
typedef struct stest {
uint64_t a:1;
uint64_t b:1;
}STest;
void
goo (STest *t, uint64_t *a, uint64_t *b)
{
*a = t->a;
}
At the expand phase, I see:
(insn 9 8 10 3 struct4.c:24 (set (subreg:DI (reg:QI 76) 0)
(zero_extract:DI (reg:DI 75)
(const_int 1 [0x1])
(const_int 0 [0x0]))) -1 (nil))
(insn 10 9 11 3 struct4.c:24 (set (reg:DI 77)
(zero_extend:DI (reg:QI 76))) -1 (nil))
Is there anything I can do to remove that zero_extend?
Thanks,
Jc
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bit fields
2009-08-31 21:27 ` Jean Christophe Beyler
@ 2009-08-31 21:53 ` Richard Henderson
[not found] ` <c568a2600908311407i154c858eq9c5b085cafdc4d3b@mail.gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2009-08-31 21:53 UTC (permalink / raw)
To: Jean Christophe Beyler; +Cc: Ian Lance Taylor, gcc
On 08/31/2009 01:07 PM, Jean Christophe Beyler wrote:
> If I replace this :
> (define_insn "extzv"
> [(set (match_operand 0 "register_operand" "")
> (zero_extract (match_operand 1 "register_operand" "")
> (match_operand 2 "const_int_operand" "")
> (match_operand 3 "const_int_operand" "")))]
> ""
> "")
Well, I can tell you that an insn pattern with no modes
on the non-immediate operands will definitely cause problems.
> (insn 9 8 10 3 struct4.c:24 (set (subreg:DI (reg:QI 76) 0)
> (zero_extract:DI (reg:DI 75)
> (const_int 1 [0x1])
> (const_int 0 [0x0]))) -1 (nil))
>
> (insn 10 9 11 3 struct4.c:24 (set (reg:DI 77)
> (zero_extend:DI (reg:QI 76))) -1 (nil))
>
> Is there anything I can do to remove that zero_extend?
You could try either using a predicate that disallows
a subreg, or by having your expander rewrite things into
(set (reg:DI new-scratch))
(zero_extract:DI ...))
(set (reg:QI 76 (subreg:QI (reg:DI new scratch)))
and relying on subsequent passes to clean that up.
r~
^ permalink raw reply [flat|nested] 7+ messages in thread
* Patch for 2.95.3
@ 2000-12-07 3:33 Gunther Nikl
2000-12-07 5:39 ` Bernd Schmidt
0 siblings, 1 reply; 7+ messages in thread
From: Gunther Nikl @ 2000-12-07 3:33 UTC (permalink / raw)
To: gcc; +Cc: bernds
Hello!
I would like to see the following patch installed in 2.95.3:
http://gcc.gnu.org/ml/gcc-patches/2000-01/msg00000.html
This patch fixes the loss of a pending stack adjust (happens eg. on
m68k for m68060)
Gunther Nikl
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-09-01 14:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-31 20:07 Bit fields Jean Christophe Beyler
2009-08-31 20:36 ` Ian Lance Taylor
2009-08-31 21:27 ` Jean Christophe Beyler
2009-08-31 21:53 ` Richard Henderson
[not found] ` <c568a2600908311407i154c858eq9c5b085cafdc4d3b@mail.gmail.com>
[not found] ` <4A9C4029.2070205@redhat.com>
2009-09-01 2:20 ` Jean Christophe Beyler
2009-09-01 14:54 ` Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
2000-12-07 3:33 Patch for 2.95.3 Gunther Nikl
2000-12-07 5:39 ` Bernd Schmidt
2000-12-07 6:58 ` Bit Fields Matt Minnis
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).