From 12da4128ff06338769bdc32d8600e535dbcec290 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Sun, 7 Oct 2012 19:53:14 -0400 Subject: [PATCH] ck_pr: Adopt const qualifer for load/store. We will adopt these semantics for the rest of _ptr family at some point in the future as well. --- include/gcc/ppc/ck_pr.h | 4 ++-- include/gcc/ppc64/ck_pr.h | 4 ++-- include/gcc/sparcv9/ck_pr.h | 4 ++-- include/gcc/x86/ck_pr.h | 4 ++-- include/gcc/x86_64/ck_pr.h | 16 ++++++++-------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/gcc/ppc/ck_pr.h b/include/gcc/ppc/ck_pr.h index de51914..c063594 100644 --- a/include/gcc/ppc/ck_pr.h +++ b/include/gcc/ppc/ck_pr.h @@ -96,7 +96,7 @@ ck_pr_barrier(void) #define CK_PR_LOAD(S, M, T, C, I) \ CK_CC_INLINE static T \ - ck_pr_load_##S(M *target) \ + ck_pr_load_##S(const M *target) \ { \ T r; \ __asm__ __volatile__(I "%U1%X1 %0, %1" \ @@ -132,7 +132,7 @@ CK_PR_LOAD_S(char, char, "lbz") return; \ } -CK_PR_STORE(ptr, void, void *, uint32_t, "stw") +CK_PR_STORE(ptr, void, const void *, uint32_t, "stw") #define CK_PR_STORE_S(S, T, I) CK_PR_STORE(S, T, T, T, I) diff --git a/include/gcc/ppc64/ck_pr.h b/include/gcc/ppc64/ck_pr.h index 4a25ff3..9896077 100644 --- a/include/gcc/ppc64/ck_pr.h +++ b/include/gcc/ppc64/ck_pr.h @@ -99,7 +99,7 @@ ck_pr_barrier(void) #define CK_PR_LOAD(S, M, T, C, I) \ CK_CC_INLINE static T \ - ck_pr_load_##S(M *target) \ + ck_pr_load_##S(const M *target) \ { \ T r; \ __asm__ __volatile__(I "%U1%X1 %0, %1" \ @@ -137,7 +137,7 @@ CK_PR_LOAD_S(double, double, "ld") return; \ } -CK_PR_STORE(ptr, void, void *, uint64_t, "std") +CK_PR_STORE(ptr, void, const void *, uint64_t, "std") #define CK_PR_STORE_S(S, T, I) CK_PR_STORE(S, T, T, T, I) diff --git a/include/gcc/sparcv9/ck_pr.h b/include/gcc/sparcv9/ck_pr.h index cf3873a..9c038ea 100644 --- a/include/gcc/sparcv9/ck_pr.h +++ b/include/gcc/sparcv9/ck_pr.h @@ -98,7 +98,7 @@ ck_pr_barrier(void) #define CK_PR_LOAD(S, M, T, C, I) \ CK_CC_INLINE static T \ - ck_pr_load_##S(M *target) \ + ck_pr_load_##S(const M *target) \ { \ T r; \ __asm__ __volatile__(I " [%1], %0" \ @@ -133,7 +133,7 @@ CK_PR_LOAD_S(int, int, "ldsw") return; \ } -CK_PR_STORE(ptr, void, void *, uint64_t, "stx") +CK_PR_STORE(ptr, void, const void *, uint64_t, "stx") #define CK_PR_STORE_S(S, T, I) CK_PR_STORE(S, T, T, T, I) diff --git a/include/gcc/x86/ck_pr.h b/include/gcc/x86/ck_pr.h index d5e0861..c85a49e 100644 --- a/include/gcc/x86/ck_pr.h +++ b/include/gcc/x86/ck_pr.h @@ -140,7 +140,7 @@ CK_PR_FAS_S(8, uint8_t, "xchgb") #define CK_PR_LOAD(S, M, T, C, I) \ CK_CC_INLINE static T \ - ck_pr_load_##S(M *target) \ + ck_pr_load_##S(const M *target) \ { \ T r; \ __asm__ __volatile__(I " %1, %0" \ @@ -175,7 +175,7 @@ CK_PR_LOAD_S(8, uint8_t, "movb") return; \ } -CK_PR_STORE(ptr, void, void *, char, "movl") +CK_PR_STORE(ptr, void, const void *, char, "movl") #define CK_PR_STORE_S(S, T, I) CK_PR_STORE(S, T, T, T, I) diff --git a/include/gcc/x86_64/ck_pr.h b/include/gcc/x86_64/ck_pr.h index 281c68c..763c6c1 100644 --- a/include/gcc/x86_64/ck_pr.h +++ b/include/gcc/x86_64/ck_pr.h @@ -144,7 +144,7 @@ CK_PR_FAS_S(8, uint8_t, "xchgb") */ #define CK_PR_LOAD(S, M, T, C, I) \ CK_CC_INLINE static T \ - ck_pr_load_##S(M *target) \ + ck_pr_load_##S(const M *target) \ { \ T r; \ __asm__ __volatile__(I " %1, %0" \ @@ -171,15 +171,14 @@ CK_PR_LOAD_S(8, uint8_t, "movb") #undef CK_PR_LOAD CK_CC_INLINE static void -ck_pr_load_64_2(uint64_t target[2], uint64_t v[2]) +ck_pr_load_64_2(const uint64_t target[2], uint64_t v[2]) { __asm__ __volatile__("movq %%rdx, %%rcx;" "movq %%rax, %%rbx;" CK_PR_LOCK_PREFIX "cmpxchg16b %0;" - : "+m" (*(uint64_t *)target), - "=a" (v[0]), + : "=a" (v[0]), "=d" (v[1]) - : + : "m" (*(const uint64_t *)target) : "rbx", "rcx", "memory", "cc"); return; } @@ -193,9 +192,10 @@ ck_pr_load_ptr_2(void *t, void *v) #define CK_PR_LOAD_2(S, W, T) \ CK_CC_INLINE static void \ - ck_pr_load_##S##_##W(T t[2], T v[2]) \ + ck_pr_load_##S##_##W(const T t[2], T v[2]) \ { \ - ck_pr_load_64_2((uint64_t *)(void *)t, (uint64_t *)(void *)v); \ + ck_pr_load_64_2((const uint64_t *)(const void *)t, \ + (uint64_t *)(void *)v); \ return; \ } @@ -222,7 +222,7 @@ CK_PR_LOAD_2(8, 16, uint8_t) return; \ } -CK_PR_STORE(ptr, void, void *, char, "movq") +CK_PR_STORE(ptr, void, const void *, char, "movq") #define CK_PR_STORE_S(S, T, I) CK_PR_STORE(S, T, T, T, I)