public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: qu <xianmiao@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1057] C-SKY: Add instruction "ld.bs".
Date: Wed, 26 May 2021 02:05:34 +0000 (GMT)	[thread overview]
Message-ID: <20210526020534.5216F385802B@sourceware.org> (raw)

https://gcc.gnu.org/g:94079e642d95ba4bcb75354d6cd628a473a94479

commit r12-1057-g94079e642d95ba4bcb75354d6cd628a473a94479
Author: Geng Qi <gengqi@linux.alibaba.com>
Date:   Tue May 25 18:45:25 2021 +0800

    C-SKY: Add instruction "ld.bs".
    
    gcc/
            * config/csky/csky.md (cskyv2_sextend_ldbs): New.
    
    gcc/testsuite/
            * gcc.target/csky/ldbs.c: New.

Diff:
---
 gcc/config/csky/csky.md              | 10 ++++++++++
 gcc/testsuite/gcc.target/csky/ldbs.c | 11 +++++++++++
 2 files changed, 21 insertions(+)

diff --git a/gcc/config/csky/csky.md b/gcc/config/csky/csky.md
index c27d627e183..b980d4c8fcb 100644
--- a/gcc/config/csky/csky.md
+++ b/gcc/config/csky/csky.md
@@ -1533,6 +1533,7 @@
   }"
 )
 
+;; hi -> si
 (define_insn "extendhisi2"
   [(set (match_operand:SI		  0 "register_operand" "=r")
 	(sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
@@ -1557,6 +1558,15 @@
   "sextb  %0, %1"
 )
 
+(define_insn "*cskyv2_sextend_ldbs"
+  [(set (match_operand:SI		  0 "register_operand" "=r")
+        (sign_extend:SI (match_operand:QI 1 "csky_simple_mem_operand" "m")))]
+  "CSKY_ISA_FEATURE (E2)"
+  "ld.bs\t%0, %1"
+  [(set_attr "length" "4")
+   (set_attr "type" "load")]
+)
+
 ;; qi -> hi
 (define_insn "extendqihi2"
   [(set (match_operand:HI		  0 "register_operand" "=r")
diff --git a/gcc/testsuite/gcc.target/csky/ldbs.c b/gcc/testsuite/gcc.target/csky/ldbs.c
new file mode 100644
index 00000000000..27a02543413
--- /dev/null
+++ b/gcc/testsuite/gcc.target/csky/ldbs.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-mcpu=ck801" "-march=ck801" } { "*" } } */
+/* { dg-csky-options "-O1" } */
+
+int foo (signed char *pb)
+{
+  return *pb;
+}
+
+/* { dg-final { scan-assembler "ld.bs" } } */
+


                 reply	other threads:[~2021-05-26  2:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210526020534.5216F385802B@sourceware.org \
    --to=xianmiao@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).