[committed] MSP430: Define extendqipsi2

Message ID 20200721164855.255vfjfsbkfqkhbc@jozef-acer-manjaro
State New
Headers show
Series
  • [committed] MSP430: Define extendqipsi2
Related show

Commit Message

Jozef Lawrynowicz July 21, 2020, 4:48 p.m.
The SXT instruction extends the sign of the low byte of the operand
through the entire PSImode register.
SXTX.A can be used to sign extend the low byte of a memory operand
through to the 19th bit. Bits 31:20 are cleared.

Successfully regtested on trunk for msp430-elf.
Committed as obvious.
From aa360dd1c882b943066ba088861c0bfac9df930d Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>

Date: Tue, 21 Jul 2020 17:24:03 +0100
Subject: [PATCH] MSP430: Define extendqipsi2

The SXT instruction extends the sign of the low byte of the operand
through the entire PSImode register.
SXTX.A can be used to sign extend the low byte of a memory operand
through to the 19th bit. Bits 31:20 are cleared.

gcc/ChangeLog:

	* config/msp430/msp430.md: New "extendqipsi2" define_insn.
---
 gcc/config/msp430/msp430.md | 9 +++++++++
 1 file changed, 9 insertions(+)

-- 
2.27.0

Patch

diff --git a/gcc/config/msp430/msp430.md b/gcc/config/msp430/msp430.md
index b6602fbca66..99299bd70ef 100644
--- a/gcc/config/msp430/msp430.md
+++ b/gcc/config/msp430/msp430.md
@@ -553,6 +553,15 @@  (define_insn "extendqihi2"
    SXT%X0\t%0"
 )
 
+(define_insn "extendqipsi2"
+  [(set (match_operand:PSI		   0 "msp430_general_dst_operand" "=r,m")
+	(sign_extend:PSI (match_operand:QI 1 "msp430_general_operand" "0,0")))]
+  ""
+  "@
+  SXT\t%0
+  SXTX.A\t%0"
+)
+
 ;; ------------------------
 ;; ZERO EXTEND INSTRUCTIONS
 ;; Byte-writes to registers clear bits 19:8