Hi,
On Fri, Jun 14 2019, Tejas Joshi wrote:
>> Of course the instruction is not present there, that is the next step in
>> your project :-)
>
> Yes, of course, but what I meant was that instructions for existing
> round/ceil functions and not roundeven. If inlining for these
> functions is available, how can I inspect such instructions getting
> inlined maybe in a *.s file?
Make sure you compile to a target that has the rounding instruction,
i.e. by using an appropriate -march or -mavx) and also specify
-ffast-math on the command line. I have not double checked, but I
assume the latter is necessary (mainly) because it implies
-fno-math-errno and most of the math builtin expansion into instructions
is guarded by check for !flag_errno_math.
So e.g. my test input:
double
callplusone (double d)
{
return __builtin_round (d) + 1;
}
has vroundsd instruction in the output of:
~/gcc/trunk/inst/bin/gcc -O2 -S expand_example.c -mavx -ffast-math
>
> Also, I am trying to find appropriate places to introduce changes for
> roundeven to be inlined. Attached patch is what I have tried so far to
> find the places.
So far I only quickly glanced over it but it seems to be going in the
right direction. I'll try to answer the rest of your questions as soon
as I can but I also have to look a bit into the machine descriptions
myself first.
Martin
> ix86_expand_roundeven have dummy code for the sake of time.
>
> In i386.md:
> 1. How should roundeven be defined at certain places where existing
> floor is defined as:
> (define_int_attr rounding_insn
> [(UNSPEC_FRNDINT_FLOOR "floor")
>
> 2. Also, can roundeven be handled like round_floor is handled by:
> (define_expand "<rounding_insn><mode>2"
> but definitely with certain changes of flags, options and macros.
>
> Thanks,
> --Tejas