[PATCH] D30061: [NDS32 29/46] Transform call texternalsym to JAL Instruction

Shiva Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 16 17:30:54 PST 2017


shiva0217 created this revision.

Transform call texternalsym to JAL Instruction


https://reviews.llvm.org/D30061

Files:
  lib/Target/NDS32/NDS32InstrInfo.td
  test/CodeGen/NDS32/extern-symbal-call.ll


Index: test/CodeGen/NDS32/extern-symbal-call.ll
===================================================================
--- /dev/null
+++ test/CodeGen/NDS32/extern-symbal-call.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s | FileCheck %s
+target datalayout = "e-m:e-p:32:32-i64:64-a:0:32-n32-S64"
+target triple = "nds32le---elf"
+
+; Function Attrs: norecurse nounwind readnone
+define i32 @extern_symbal_call(float %a, float %b) local_unnamed_addr #0 {
+entry:
+  %cmp = fcmp oeq float %a, %b
+  %conv = zext i1 %cmp to i32
+; CHECK: jal     __eqsf2
+  ret i32 %conv
+}
Index: lib/Target/NDS32/NDS32InstrInfo.td
===================================================================
--- lib/Target/NDS32/NDS32InstrInfo.td
+++ lib/Target/NDS32/NDS32InstrInfo.td
@@ -618,6 +618,10 @@
 def : Pat<(i32 (extloadi16 addr_imm15s_half:$src)), (LHI addr_imm15s_half:$src)>;
 def : Pat<(i32 (extloadi8 addr_imm15s_byte:$src)), (LBI addr_imm15s_byte:$src)>;
 
+// call patterns
+def : Pat<(NDS32call (i32 texternalsym:$dst)),
+          (JAL texternalsym:$dst)>;
+
 
 //===----------------------------------------------------------------------===//
 // Conditional Move Instructions


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30061.88816.patch
Type: text/x-patch
Size: 1157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170217/e08ef039/attachment.bin>


More information about the llvm-commits mailing list