aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Green <green@moxielogic.com>2014-04-03 02:11:34 +0000
committerAnthony Green <green@gcc.gnu.org>2014-04-03 02:11:34 +0000
commit2b9912aa3c48b911e6382355b6756e45002a604e (patch)
treea5a55568c37cbe8202d239c644d3780405a87c21
parentdb034eacd3c55f2a3b49ac71cd23a5a890759bb1 (diff)
downloadgcc-2b9912aa3c48b911e6382355b6756e45002a604e.zip
gcc-2b9912aa3c48b911e6382355b6756e45002a604e.tar.gz
gcc-2b9912aa3c48b911e6382355b6756e45002a604e.tar.bz2
This patch does three related things for the moxie port...
1. Changes char to be unsigned by default 2. Changes WCHAR_TYPE from long int to unsigned int 3. Zero- and sign-extends values properly, sometimes using the new sign-extension instructions. From-SVN: r209047
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/moxie/moxie.h4
-rw-r--r--gcc/config/moxie/moxie.md50
3 files changed, 59 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6a473c8..ec100b2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2014-04-02 Anthony Green <green@moxielogic.com>
+
+ * config/moxie/moxie.md (zero_extendqisi2, zero_extendhisi2)
+ (extendqisi2, extendhisi2): Define.
+ * config/moxie/moxie.h (DEFAULT_SIGNED_CHAR): Change to 0.
+ (WCHAR_TYPE): Change to unsigned int.
+
2014-04-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/60733
diff --git a/gcc/config/moxie/moxie.h b/gcc/config/moxie/moxie.h
index 5379a43..3a01dba 100644
--- a/gcc/config/moxie/moxie.h
+++ b/gcc/config/moxie/moxie.h
@@ -59,7 +59,7 @@
#define DOUBLE_TYPE_SIZE 64
#define LONG_DOUBLE_TYPE_SIZE 64
-#define DEFAULT_SIGNED_CHAR 1
+#define DEFAULT_SIGNED_CHAR 0
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
@@ -68,7 +68,7 @@
#define PTRDIFF_TYPE "int"
#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
+#define WCHAR_TYPE "unsigned int"
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE BITS_PER_WORD
diff --git a/gcc/config/moxie/moxie.md b/gcc/config/moxie/moxie.md
index 713f9b6..edefef8 100644
--- a/gcc/config/moxie/moxie.md
+++ b/gcc/config/moxie/moxie.md
@@ -239,6 +239,56 @@
ldo.l %0, %1"
[(set_attr "length" "2,2,6,2,6,2,6,6,6")])
+(define_insn_and_split "zero_extendqisi2"
+ [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
+ (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,W,A,B")))]
+ ""
+ "@
+ ;
+ ld.b %0, %1
+ lda.b %0, %1
+ ldo.b %0, %1
+ "reload_completed"
+ [(set (match_dup 2) (match_dup 1))
+ (set (match_dup 0) (zero_extend:SI (match_dup 2)))]
+{
+ operands[2] = gen_lowpart (QImode, operands[0]);
+}
+ [(set_attr "length" "0,2,6,6")])
+
+(define_insn_and_split "zero_extendhisi2"
+ [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
+ (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,W,A,B")))]
+ ""
+ "@
+ ;
+ ld.s %0, %1
+ lda.s %0, %1
+ ldo.s %0, %1
+ "reload_completed"
+ [(set (match_dup 2) (match_dup 1))
+ (set (match_dup 0) (zero_extend:SI (match_dup 2)))]
+{
+ operands[2] = gen_lowpart (HImode, operands[0]);
+}
+ [(set_attr "length" "0,2,6,6")])
+
+(define_insn "extendqisi2"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r")))]
+ ""
+ "@
+ sex.b %0, %1"
+ [(set_attr "length" "2")])
+
+(define_insn "extendhisi2"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r")))]
+ ""
+ "@
+ sex.s %0, %1"
+ [(set_attr "length" "2")])
+
(define_expand "movqi"
[(set (match_operand:QI 0 "general_operand" "")
(match_operand:QI 1 "general_operand" ""))]