[hackers] [scc] [cc2-qbe] Add signed/unsigned version of shr || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 22 Apr 2016 18:13:47 +0200 (CEST)

commit a9ca038e47093dad4d9961bcd5f2e209635dbb79
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
AuthorDate: Thu Apr 21 03:12:53 2016 +0200
Commit: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
CommitDate: Thu Apr 21 03:12:53 2016 +0200

    [cc2-qbe] Add signed/unsigned version of shr
    
    Shr can extend the sign if the type has sign, so it is important to
    differentiate between them.

diff --git a/cc2/arch/qbe/arch.h b/cc2/arch/qbe/arch.h
index 78f058b..7c9e69e 100644
--- a/cc2/arch/qbe/arch.h
+++ b/cc2/arch/qbe/arch.h
_AT_@ -17,6 +17,7 @@ enum asmop {
         ASUDIVW,
         ASSHLW,
         ASSHRW,
+ ASUSHRW,
         ASLTW,
         ASULTW,
         ASGTW,
_AT_@ -41,6 +42,7 @@ enum asmop {
         ASUDIVL,
         ASSHLL,
         ASSHRL,
+ ASUSHRL,
         ASLTL,
         ASULTL,
         ASGTL,
diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index 7961178..cd0edcc 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -142,6 +142,7 @@ cgen(Node *np)
         case OMEM:
         case OAUTO:
                 return np;
+ case OSHR:
         case OMOD:
         case ODIV:
         case OLT:
_AT_@ -158,7 +159,6 @@ cgen(Node *np)
         case OSUB:
         case OMUL:
         case OSHL:
- case OSHR:
         case OBAND:
         case OBOR:
         case OBXOR:
diff --git a/cc2/arch/qbe/code.c b/cc2/arch/qbe/code.c
index b956dfb..f668c60 100644
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
_AT_@ -27,7 +27,8 @@ static struct opdata {
         [ASDIVW] = {.fun = binary, .txt = "div", .letter = 'w'},
         [ASUDIVW] = {.fun = binary, .txt = "udiv", .letter = 'w'},
         [ASSHLW] = {.fun = binary, .txt = "shl", .letter = 'w'},
- [ASSHRW] = {.fun = binary, .txt = "shr", .letter = 'w'},
+ [ASSHRW] = {.fun = binary, .txt = "shrs", .letter = 'w'},
+ [ASUSHRW] = {.fun = binary, .txt = "shrz", .letter = 'w'},
         [ASLTW] = {.fun = binary, .txt = "csltw", .letter = 'w'},
         [ASULTW] = {.fun = binary, .txt = "cultw", .letter = 'w'},
         [ASGTW] = {.fun = binary, .txt = "csgtw", .letter = 'w'},
_AT_@ -50,7 +51,8 @@ static struct opdata {
         [ASDIVL] = {.fun = binary, .txt = "div", .letter = 'l'},
         [ASUDIVL] = {.fun = binary, .txt = "udiv", .letter = 'l'},
         [ASSHLL] = {.fun = binary, .txt = "shl", .letter = 'l'},
- [ASSHRL] = {.fun = binary, .txt = "shr", .letter = 'l'},
+ [ASSHRL] = {.fun = binary, .txt = "shrs", .letter = 'l'},
+ [ASUSHRL] = {.fun = binary, .txt = "shrz", .letter = 'l'},
         [ASLTL] = {.fun = binary, .txt = "csltl", .letter = 'w'},
         [ASULTL] = {.fun = binary, .txt = "cultl", .letter = 'w'},
         [ASGTL] = {.fun = binary, .txt = "csgtl", .letter = 'w'},
Received on Fri Apr 22 2016 - 18:13:47 CEST

This archive was generated by hypermail 2.3.0 : Fri Apr 22 2016 - 18:24:16 CEST