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)
Sun, Dec 8, 4:18 PM
Unknown Object (File)
Thu, Dec 5, 11:37 PM
Unknown Object (File)
Mon, Dec 2, 12:15 AM
Unknown Object (File)
Tue, Nov 26, 12:41 PM
Unknown Object (File)
Tue, Nov 26, 9:54 AM
Unknown Object (File)
Sat, Nov 23, 3:19 PM
Unknown Object (File)
Sat, Nov 23, 11:34 AM
Unknown Object (File)
Nov 22 2024, 4:20 PM
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.