From b2ec46d86034261ed42be26b42ecee6f454ee344 Mon Sep 17 00:00:00 2001 From: xleroy Date: Tue, 30 Apr 2013 10:00:32 +0000 Subject: Add bswap16 git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2223 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- checklink/Check.ml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'checklink') diff --git a/checklink/Check.ml b/checklink/Check.ml index 412d3ab..4097267 100644 --- a/checklink/Check.ml +++ b/checklink/Check.ml @@ -1191,7 +1191,7 @@ let rec compare_code ccode ecode pc: checker = fun fw -> >>= recur_simpl | _ -> error end - | "__builtin_bswap", [IR a1], [IR res] -> + | ("__builtin_bswap"|"__builtin_bswap32"), [IR a1], [IR res] -> begin match ecode with | STWU (rS0, rA0, d0) :: LWBRX(rD1, rA1, rB1) :: @@ -1209,6 +1209,28 @@ let rec compare_code ccode ecode pc: checker = fun fw -> >>= compare_code cs es (Int32.add 12l pc) | _ -> error end + | "__builtin_bswap16", [IR a1], [IR res] -> + begin match ecode with + | RLWINMx(rS1, rA1, sh1, mb1, me1, rc1) :: + RLWINMx(rS2, rA2, sh2, mb2, me2, rc2) :: + ORx(rS3, rA3, rB3, rc3) :: es -> + OK(fw) + >>= match_iregs GPR0 rS1 + >>= match_iregs a1 rA1 + >>= check_eq "bswap16-1" sh1 8 + >>= check_eq "bswap16-2" mb1 16 + >>= check_eq "bswap16-3" me1 23 + >>= match_iregs res rS2 + >>= match_iregs a1 rA2 + >>= check_eq "bswap16-4" sh2 24 + >>= check_eq "bswap16-5" mb2 24 + >>= check_eq "bswap16-6" me2 31 + >>= match_iregs res rS3 + >>= match_iregs GPR0 rA3 + >>= match_iregs res rB3 + >>= compare_code cs es (Int32.add 12l pc) + | _ -> error + end | "__builtin_fmadd", [FR a1; FR a2; FR a3], [FR res] -> begin match ecode with | FMADDx(frD, frA, frB, frC, rc) :: es -> -- cgit v1.2.3