Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MIPS64] Failure to remove random NOPs in the middle of instructions #99783

Closed
@GabrielRavier

Description

@GabrielRavier
int f(int a, int b)
{
    return (a ^ b) | ~(a | b);
}

When compiled with -O3 -target mips64el -fomit-frame-pointer, LLVM outputs:

f(int, int): # @f(int, int)
  and $1, $5, $4
  sll $1, $1, 0
  not $1, $1
  jr $ra
  sll $2, $1, 0

whereas GCC manages (with -O3):

f(int, int):
  and $4,$4,$5
  jr $31
  nor $2,$0,$4

The sll instructions seem entirely unnecessary as they are just nops from what I understand, and they don't seem required for any particular reason (using -target mipsel instead of -target mips64el also gets them removed, so this seems quite specific to 64-bit MIPS)

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