Patchwork [3/3] target-unicore32: mark a few helpers const + pure

login
register
mail settings
Submitter Aurelien Jarno
Date April 12, 2011, 10:31 p.m.
Message ID <1302647466-22448-3-git-send-email-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/90931/
State New
Headers show

Comments

Aurelien Jarno - April 12, 2011, 10:31 p.m.
Helpers that do not trigger exceptions and do only access to the arguments
can be declared as const + pure.

Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 target-unicore32/helper.h |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
Guan Xuetao - April 13, 2011, 6:03 a.m.
Applied, thanks.
Tested-and-Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>

Guan

> -----Original Message-----
> From: Aurelien Jarno [mailto:aurelien@aurel32.net]
> Sent: Wednesday, April 13, 2011 6:31 AM
> To: qemu-devel@nongnu.org
> Cc: Aurelien Jarno; Guan Xuetao
> Subject: [PATCH 3/3] target-unicore32: mark a few helpers const + pure
> 
> Helpers that do not trigger exceptions and do only access to the arguments
> can be declared as const + pure.
> 
> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
>  target-unicore32/helper.h |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/target-unicore32/helper.h b/target-unicore32/helper.h
> index 1e45302..4f8b5d7 100644
> --- a/target-unicore32/helper.h
> +++ b/target-unicore32/helper.h
> @@ -29,9 +29,9 @@ DEF_HELPER_2(adc_cc, i32, i32, i32)
>  DEF_HELPER_2(sub_cc, i32, i32, i32)
>  DEF_HELPER_2(sbc_cc, i32, i32, i32)
> 
> -DEF_HELPER_2(shl, i32, i32, i32)
> -DEF_HELPER_2(shr, i32, i32, i32)
> -DEF_HELPER_2(sar, i32, i32, i32)
> +DEF_HELPER_FLAGS_2(shl, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32, i32)
> +DEF_HELPER_FLAGS_2(shr, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32, i32)
> +DEF_HELPER_FLAGS_2(sar, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32, i32)
>  DEF_HELPER_2(shl_cc, i32, i32, i32)
>  DEF_HELPER_2(shr_cc, i32, i32, i32)
>  DEF_HELPER_2(sar_cc, i32, i32, i32)
> @@ -51,10 +51,10 @@ DEF_HELPER_2(ucf64_muls, f32, f32, f32)
>  DEF_HELPER_2(ucf64_muld, f64, f64, f64)
>  DEF_HELPER_2(ucf64_divs, f32, f32, f32)
>  DEF_HELPER_2(ucf64_divd, f64, f64, f64)
> -DEF_HELPER_1(ucf64_negs, f32, f32)
> -DEF_HELPER_1(ucf64_negd, f64, f64)
> -DEF_HELPER_1(ucf64_abss, f32, f32)
> -DEF_HELPER_1(ucf64_absd, f64, f64)
> +DEF_HELPER_FLAGS_1(ucf64_negs, TCG_CALL_CONST | TCG_CALL_PURE, f32, f32)
> +DEF_HELPER_FLAGS_1(ucf64_negd, TCG_CALL_CONST | TCG_CALL_PURE, f64, f64)
> +DEF_HELPER_FLAGS_1(ucf64_abss, TCG_CALL_CONST | TCG_CALL_PURE, f32, f32)
> +DEF_HELPER_FLAGS_1(ucf64_absd, TCG_CALL_CONST | TCG_CALL_PURE, f64, f64)
>  DEF_HELPER_3(ucf64_cmps, void, f32, f32, i32)
>  DEF_HELPER_3(ucf64_cmpd, void, f64, f64, i32)
> 
> --
> 1.7.2.3

Patch

diff --git a/target-unicore32/helper.h b/target-unicore32/helper.h
index 1e45302..4f8b5d7 100644
--- a/target-unicore32/helper.h
+++ b/target-unicore32/helper.h
@@ -29,9 +29,9 @@  DEF_HELPER_2(adc_cc, i32, i32, i32)
 DEF_HELPER_2(sub_cc, i32, i32, i32)
 DEF_HELPER_2(sbc_cc, i32, i32, i32)
 
-DEF_HELPER_2(shl, i32, i32, i32)
-DEF_HELPER_2(shr, i32, i32, i32)
-DEF_HELPER_2(sar, i32, i32, i32)
+DEF_HELPER_FLAGS_2(shl, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32, i32)
+DEF_HELPER_FLAGS_2(shr, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32, i32)
+DEF_HELPER_FLAGS_2(sar, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32, i32)
 DEF_HELPER_2(shl_cc, i32, i32, i32)
 DEF_HELPER_2(shr_cc, i32, i32, i32)
 DEF_HELPER_2(sar_cc, i32, i32, i32)
@@ -51,10 +51,10 @@  DEF_HELPER_2(ucf64_muls, f32, f32, f32)
 DEF_HELPER_2(ucf64_muld, f64, f64, f64)
 DEF_HELPER_2(ucf64_divs, f32, f32, f32)
 DEF_HELPER_2(ucf64_divd, f64, f64, f64)
-DEF_HELPER_1(ucf64_negs, f32, f32)
-DEF_HELPER_1(ucf64_negd, f64, f64)
-DEF_HELPER_1(ucf64_abss, f32, f32)
-DEF_HELPER_1(ucf64_absd, f64, f64)
+DEF_HELPER_FLAGS_1(ucf64_negs, TCG_CALL_CONST | TCG_CALL_PURE, f32, f32)
+DEF_HELPER_FLAGS_1(ucf64_negd, TCG_CALL_CONST | TCG_CALL_PURE, f64, f64)
+DEF_HELPER_FLAGS_1(ucf64_abss, TCG_CALL_CONST | TCG_CALL_PURE, f32, f32)
+DEF_HELPER_FLAGS_1(ucf64_absd, TCG_CALL_CONST | TCG_CALL_PURE, f64, f64)
 DEF_HELPER_3(ucf64_cmps, void, f32, f32, i32)
 DEF_HELPER_3(ucf64_cmpd, void, f64, f64, i32)