From f6b50558fc46aeb8e981355009871b30e61de841 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 14 Jun 2013 16:18:16 +0200 Subject: [PATCH] Add support for load/store of _Bool value Add support for loading _Bool value in i386, x86_64 and arm as well as support for storing _Bool value on arm. --- arm-gen.c | 4 ++-- i386-gen.c | 2 +- x86_64-gen.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arm-gen.c b/arm-gen.c index 250b1d91..eccfdd8a 100644 --- a/arm-gen.c +++ b/arm-gen.c @@ -571,7 +571,7 @@ void load(int r, SValue *sv) op=0xE5100000; if(!sign) op|=0x800000; - if ((ft & VT_BTYPE) == VT_BYTE) + if ((ft & VT_BTYPE) == VT_BYTE || (ft & VT_BTYPE) == VT_BOOL) op|=0x400000; o(op|(intr(r)<<12)|fc|(base<<16)); } @@ -699,7 +699,7 @@ void store(int r, SValue *sv) op=0xE5000000; if(!sign) op|=0x800000; - if ((ft & VT_BTYPE) == VT_BYTE) + if ((ft & VT_BTYPE) == VT_BYTE || (ft & VT_BTYPE) == VT_BOOL) op|=0x400000; o(op|(intr(r)<<12)|fc|(base<<16)); } diff --git a/i386-gen.c b/i386-gen.c index 2a4007c7..844a482b 100644 --- a/i386-gen.c +++ b/i386-gen.c @@ -244,7 +244,7 @@ ST_FUNC void load(int r, SValue *sv) } else if ((ft & VT_BTYPE) == VT_LDOUBLE) { o(0xdb); /* fldt */ r = 5; - } else if ((ft & VT_TYPE) == VT_BYTE) { + } else if ((ft & VT_TYPE) == VT_BYTE || (ft & VT_TYPE) == VT_BOOL) { o(0xbe0f); /* movsbl */ } else if ((ft & VT_TYPE) == (VT_BYTE | VT_UNSIGNED)) { o(0xb60f); /* movzbl */ diff --git a/x86_64-gen.c b/x86_64-gen.c index 27886774..d1bf75c5 100644 --- a/x86_64-gen.c +++ b/x86_64-gen.c @@ -414,7 +414,7 @@ void load(int r, SValue *sv) r = REG_VALUE(r); } else if ((ft & VT_BTYPE) == VT_LDOUBLE) { b = 0xdb, r = 5; /* fldt */ - } else if ((ft & VT_TYPE) == VT_BYTE) { + } else if ((ft & VT_TYPE) == VT_BYTE || (ft & VT_TYPE) == VT_BOOL) { b = 0xbe0f; /* movsbl */ } else if ((ft & VT_TYPE) == (VT_BYTE | VT_UNSIGNED)) { b = 0xb60f; /* movzbl */