[PATCH] D47319: [Sparc] Add .uahalf and .uaword directives

Daniel Cederman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 24 05:32:54 PDT 2018


dcederman created this revision.
dcederman added reviewers: jyknight, asb.
Herald added subscribers: llvm-commits, jrtc27, fedor.sergeev.

Adding these makes it easier to assemble the output from GCC which generates a lot of .uahalf and .uaword directives.

GAS treats .uahalf and .half the same unless the --enforce-aligned-data flag is used. I could not find a similar flag for LLVM so it seems that .half does not have any alignment requirement and is treated the same as .uahalf should be. If that would change later on then the tests in sparc-directives.s would fail due to bad alignment.


Repository:
  rL LLVM

https://reviews.llvm.org/D47319

Files:
  lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
  test/MC/Sparc/sparc-directives.s


Index: test/MC/Sparc/sparc-directives.s
===================================================================
--- test/MC/Sparc/sparc-directives.s
+++ test/MC/Sparc/sparc-directives.s
@@ -9,13 +9,19 @@
         ! SPARC64: .byte 24
         .byte 24
 
+        ! SPARC32: .half 1024
+        ! SPARC64: .half 1024
         ! SPARC32: .half 1024
         ! SPARC64: .half 1024
         .half 1024
+        .uahalf 1024
 
+        ! SPARC32: .word 65536
+        ! SPARC64: .word 65536
         ! SPARC32: .word 65536
         ! SPARC64: .word 65536
         .word 65536
+        .uaword 65536
 
         ! SPARC32: .word 65536
         ! SPARC64: .xword 65536
Index: lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
===================================================================
--- lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
+++ lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
@@ -109,7 +109,9 @@
                 const MCTargetOptions &Options)
       : MCTargetAsmParser(Options, sti, MII), Parser(parser) {
     Parser.addAliasForDirective(".half", ".2byte");
+    Parser.addAliasForDirective(".uahalf", ".2byte");
     Parser.addAliasForDirective(".word", ".4byte");
+    Parser.addAliasForDirective(".uaword", ".4byte");
     Parser.addAliasForDirective(".nword", is64Bit() ? ".8byte" : ".4byte");
     if (is64Bit())
       Parser.addAliasForDirective(".xword", ".8byte");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47319.148387.patch
Type: text/x-patch
Size: 1379 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180524/af86e264/attachment.bin>


More information about the llvm-commits mailing list