diff mbox

Commit: MSP430: Fix zero-extending a 16-bit value to a 20-bit value, in memory

Message ID 876164hzzz.fsf@redhat.com
State New
Headers show

Commit Message

Nick Clifton July 1, 2015, 11:35 a.m. UTC
Hi Guys,

  I am applying the patch below to fix a problem with the MSP430's
  zero_extendhipsi2 pattern.  When the destination is memory, four bytes
  must be written, even though only a 20-bit value is being stored, as
  otherwise the top nibble will be lost.

Cheers
  Nick

gcc/ChangeLog
2015-07-01  Nick Clifton  <nickc@redhat.com>

	* config/msp430/msp430.md (zero_extendhipsi2): Use MOVX.A to store
	a 16-bit value into a 20-bit memory slot.
diff mbox

Patch

Index: config/msp430/msp430.md
===================================================================
--- config/msp430/msp430.md	(revision 225239)
+++ config/msp430/msp430.md	(working copy)
@@ -572,7 +572,9 @@ 
   [(set (match_operand:PSI                 0 "msp_nonimmediate_operand" "=r,m")
 	(zero_extend:PSI (match_operand:HI 1 "msp_nonimmediate_operand" "rm,r")))]
   ""
-  "MOVX\t%1, %0"
+  "@
+  MOVX\t%1, %0
+  MOVX.A\t%1, %0"
 )
 
 (define_insn "truncpsihi2"