Recognize bswapl as bswap too.
authorDan Gohman <gohman@apple.com>
Tue, 17 Mar 2009 02:45:40 +0000 (02:45 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 17 Mar 2009 02:45:40 +0000 (02:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67072 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86TargetAsmInfo.cpp
test/CodeGen/X86/bswap-inline-asm.ll

index f3faa7022cdf7c9ff1b48f16ecb359f0f610b120..f1d97a3893226dd3d8b0ae1bab1eab6496045864 100644 (file)
@@ -411,8 +411,11 @@ bool X86TargetAsmInfo<BaseTAI>::ExpandInlineAsm(CallInst *CI) const {
 
     // bswap $0
     if (AsmPieces.size() == 2 &&
-        (AsmPieces[0] == "bswap" || AsmPieces[0] == "bswapq") &&
-        (AsmPieces[1] == "$0" || AsmPieces[1] == "${0:q}")) {
+        (AsmPieces[0] == "bswap" ||
+         AsmPieces[0] == "bswapq" ||
+         AsmPieces[0] == "bswapl") &&
+        (AsmPieces[1] == "$0" ||
+         AsmPieces[1] == "${0:q}")) {
       // No need to check constraints, nothing other than the equivalent of
       // "=r,0" would be valid here.
       return LowerToBSwap(CI);
index c44d845c832db86bae9693d246945e7b7bff207a..91f8310361ad5d70e776bcb622a131a9f37505b7 100644 (file)
@@ -1,6 +1,7 @@
 ; RUN: llvm-as < %s | llc -march=x86-64 > %t
 ; RUN: not grep APP %t
 ; RUN: grep bswapq %t | count 2
+; RUN: grep bswapl %t | count 1
 
 define i64 @foo(i64 %x) nounwind {
        %asmtmp = tail call i64 asm "bswap $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %x) nounwind
@@ -10,3 +11,7 @@ define i64 @bar(i64 %x) nounwind {
        %asmtmp = tail call i64 asm "bswapq ${0:q}", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %x) nounwind
        ret i64 %asmtmp
 }
+define i32 @pen(i32 %x) nounwind {
+       %asmtmp = tail call i32 asm "bswapl ${0:q}", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %x) nounwind
+       ret i32 %asmtmp
+}