[PATCH] implement fmod() as built-in x87 intrinsic

Roger Sayle roger@eyesopen.com
Wed May 5 01:30:00 GMT 2004


On Tue, 4 May 2004, Uros Bizjak wrote:
> I forgot to say, that if I change fnstsw instruction to this:
>
> (define_insn "x86_fnstsw_1"
>   [(set (match_operand:HI 0 "register_operand" "=a")
>     (unspec:HI [(reg:CC 18)] UNSPEC_FNSTSW))]
>   "TARGET_80387"
>   "fnstsw\t%0"
>   [(set_attr "length" "2")
>    (set_attr "mode" "SI")
>    (set_attr "unit" "i387")])
>
> Everything works as expected, instructions doesn't change places and
> (reg 18) is not marked as REG_UNUSED anymore. This is the solution, but
> I don't know what part of compiler will break with this change.

I suspect that (reg 18) should be written as (reg:CCFP 18) in both the
x86_fnstsw_1 instruction and in the fpremxf_1 clobber.  The majority of
uses of reg 18 specify CCFPmode, and every use of UNSPEC_FNSTSW, except
this one, has CCFPmode as the inner/operand mode and HImode as the
outer/result mode.

Roger
--



More information about the Gcc-patches mailing list