[llvm-commits] [llvm] r67072 - in /llvm/trunk: lib/Target/X86/X86TargetAsmInfo.cpp test/CodeGen/X86/bswap-inline-asm.ll

Dan Gohman gohman at apple.com
Mon Mar 16 19:45:40 PDT 2009


Author: djg
Date: Mon Mar 16 21:45:40 2009
New Revision: 67072

URL: http://llvm.org/viewvc/llvm-project?rev=67072&view=rev
Log:
Recognize bswapl as bswap too.

Modified:
    llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
    llvm/trunk/test/CodeGen/X86/bswap-inline-asm.ll

Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=67072&r1=67071&r2=67072&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Mar 16 21:45:40 2009
@@ -411,8 +411,11 @@
 
     // 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);

Modified: llvm/trunk/test/CodeGen/X86/bswap-inline-asm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/bswap-inline-asm.ll?rev=67072&r1=67071&r2=67072&view=diff

==============================================================================
--- llvm/trunk/test/CodeGen/X86/bswap-inline-asm.ll (original)
+++ llvm/trunk/test/CodeGen/X86/bswap-inline-asm.ll Mon Mar 16 21:45:40 2009
@@ -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 @@
 	%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
+}





More information about the llvm-commits mailing list