[PATCH] D18732: [SystemZ] Support LRVH and STRVH opcodes

Bryan Chan via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 2 14:43:46 PDT 2016


bryanpkc created this revision.
bryanpkc added a reviewer: uweigand.
bryanpkc added a subscriber: llvm-commits.

On Linux, /usr/include/bits/byteswap-16.h defines __byteswap_16(x) as an inlined LRVH (Load Reversed Half-word) instruction. The SystemZ back-end did not support this opcode and the inlined assembly would cause a fatal error.

http://reviews.llvm.org/D18732

Files:
  lib/Target/SystemZ/README.txt
  lib/Target/SystemZ/SystemZInstrInfo.td

Index: lib/Target/SystemZ/SystemZInstrInfo.td
===================================================================
--- lib/Target/SystemZ/SystemZInstrInfo.td
+++ lib/Target/SystemZ/SystemZInstrInfo.td
@@ -570,10 +570,13 @@
 
 // Byte-swapping loads.  Unlike normal loads, these instructions are
 // allowed to access storage more than once.
+def LRVH : UnaryRXY<"lrvh", 0xE31F, loadu<bswap, nonvolatile_load>, GR32, 2>;
 def LRV  : UnaryRXY<"lrv",  0xE31E, loadu<bswap, nonvolatile_load>, GR32, 4>;
 def LRVG : UnaryRXY<"lrvg", 0xE30F, loadu<bswap, nonvolatile_load>, GR64, 8>;
 
 // Likewise byte-swapping stores.
+def STRVH : StoreRXY<"strvh", 0xE33F, storeu<bswap, nonvolatile_store>,
+                     GR32, 2>;
 def STRV  : StoreRXY<"strv", 0xE33E, storeu<bswap, nonvolatile_store>, GR32, 4>;
 def STRVG : StoreRXY<"strvg", 0xE32F, storeu<bswap, nonvolatile_store>,
                      GR64, 8>;
Index: lib/Target/SystemZ/README.txt
===================================================================
--- lib/Target/SystemZ/README.txt
+++ lib/Target/SystemZ/README.txt
@@ -80,7 +80,8 @@
 --
 
 We don't use the halfword forms of LOAD REVERSED and STORE REVERSED
-(LRVH and STRVH).
+(LRVH and STRVH). However, the inline assembly parser does support
+these opcodes.
 
 --
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18732.52480.patch
Type: text/x-patch
Size: 1283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160402/f1e51397/attachment.bin>


More information about the llvm-commits mailing list