Skip to content

cmd/compile: unnecessary compares following FP instructions in ppc64le #17507

@laboger

Description

@laboger

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

tip

What operating system and processor architecture are you using (go env)?

Ubuntu 16.04

What did you do?

Looking for performance improvements to the function math.mod when run as part of the math package testcase (math.test).

What did you see instead?

I'm seeing some unusual and unnecessary compare type instructions that are following floating point compare instructions when the compare is gt or lt. The eq and ne appear good.

I'm seeing code like this:

 7f5a0:       00 20 03 fc     fcmpu   cr0,f3,f4
 7f5a4:       01 00 e0 3b     li      r31,1
 7f5a8:       5e 00 7f 7c     iselgt  r3,r31,r0
 7f5ac:       00 00 03 7c     cmpw    r3,r0

Should be just bgt or blt after the fcmpu.

If the compare following the fcmpu is beq or bne then it avoids the isel like this:

7f58c:       00 10 01 fc     fcmpu   cr0,f1,f2
7f590:       60 01 82 41     beq     7f6f0 <math.mod+0x190>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions