Page MenuHomeFreeBSD

Add bswapsi2/bswapdi2 support to libcompiler-rt for mips platforms.
ClosedPublic

Authored by adrian on May 20 2017, 5:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 22 2024, 8:33 PM
Unknown Object (File)
Mar 22 2024, 8:33 PM
Unknown Object (File)
Mar 22 2024, 8:33 PM
Unknown Object (File)
Mar 8 2024, 11:47 PM
Unknown Object (File)
Feb 5 2024, 5:12 PM
Unknown Object (File)
Jan 4 2024, 6:12 AM
Unknown Object (File)
Jan 4 2024, 6:11 AM
Unknown Object (File)
Jan 4 2024, 6:11 AM
Subscribers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

LGTM, we should upstream the contrib part, though. Unfortunately llvm.org is down at the moment...

I'm fine with this so that we can unblock MIPS w/ xGCC, but would hope we can replace it with a better asm version in the future. Depending on the MIPS ISA we target I suspect there's no huge gain to be had , but there some clever tricks might save a couple of instructions.

This revision is now accepted and ready to land.May 21 2017, 6:54 PM

Using -target mips-freebsd, the assembly produced for e.g. bswapsi2.c is:

__bswapsi2:                             # @__bswapsi2
        .frame  $fp,8,$ra
        .mask   0x40000000,-4
        .fmask  0x00000000,0
        .set    noreorder
        .set    nomacro
        .set    noat
# BB#0:                                 # %entry
        addiu   $sp, $sp, -8
        sw      $fp, 4($sp)             # 4-byte Folded Spill
        move     $fp, $sp
        wsbh    $1, $4
        rotr    $2, $1, 16
        move     $sp, $fp
        lw      $fp, 4($sp)             # 4-byte Folded Reload
        jr      $ra
        addiu   $sp, $sp, 8
        .set    at
        .set    macro
        .set    reorder
        .end    __bswapsi2
$func_end0:
        .size   __bswapsi2, ($func_end0)-__bswapsi2

I'm not a mips expert, but it looks pretty OK to me... :)

This revision was automatically updated to reflect the committed changes.