Use unsigned long long in asm-x86-linux-rdmsr.c

Message ID CAMe9rOpw3KNfv4M+q1PpkOGdF1+=tF1o6cwr9JOAQArmgx_YXg@mail.gmail.com
State New
Headers
Series Use unsigned long long in asm-x86-linux-rdmsr.c |

Commit Message

H.J. Lu Oct. 2, 2021, 2:33 a.m. UTC
  On Wed, Aug 4, 2021 at 3:26 PM David Malcolm via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
> Pushed to trunk as r12-2749-gded2c2c068f6f2825474758cb03a05070a5837e8.
>
> gcc/ChangeLog:
>         PR analyzer/101570
>         * Makefile.in (ANALYZER_OBJS): Add analyzer/region-model-asm.o.
>
> gcc/analyzer/ChangeLog:
>         PR analyzer/101570
>         * analyzer.cc (maybe_reconstruct_from_def_stmt): Add GIMPLE_ASM
>         case.
>         * analyzer.h (class asm_output_svalue): New forward decl.
>         (class reachable_regions): New forward decl.
>         * complexity.cc (complexity::from_vec_svalue): New.
>         * complexity.h (complexity::from_vec_svalue): New decl.
>         * engine.cc (feasibility_state::maybe_update_for_edge): Handle
>         asm stmts by calling on_asm_stmt.
>         * region-model-asm.cc: New file.
>         * region-model-manager.cc
>         (region_model_manager::maybe_fold_asm_output_svalue): New.
>         (region_model_manager::get_or_create_asm_output_svalue): New.
>         (region_model_manager::log_stats): Log m_asm_output_values_map.
>         * region-model.cc (region_model::on_stmt_pre): Handle GIMPLE_ASM.
>         * region-model.h (visitor::visit_asm_output_svalue): New.
>         (region_model_manager::get_or_create_asm_output_svalue): New decl.
>         (region_model_manager::maybe_fold_asm_output_svalue): New decl.
>         (region_model_manager::asm_output_values_map_t): New typedef.
>         (region_model_manager::m_asm_output_values_map): New field.
>         (region_model::on_asm_stmt): New.
>         * store.cc (binding_cluster::on_asm): New.
>         * store.h (binding_cluster::on_asm): New decl.
>         * svalue.cc (svalue::cmp_ptr): Handle SK_ASM_OUTPUT.
>         (asm_output_svalue::dump_to_pp): New.
>         (asm_output_svalue::dump_input): New.
>         (asm_output_svalue::input_idx_to_asm_idx): New.
>         (asm_output_svalue::accept): New.
>         * svalue.h (enum svalue_kind): Add SK_ASM_OUTPUT.
>         (svalue::dyn_cast_asm_output_svalue): New.
>         (class asm_output_svalue): New.
>         (is_a_helper <const asm_output_svalue *>::test): New.
>         (struct default_hash_traits<asm_output_svalue::key_t>): New.
>
> gcc/testsuite/ChangeLog:
>         PR analyzer/101570
>         * gcc.dg/analyzer/asm-x86-1.c: New test.
>         * gcc.dg/analyzer/asm-x86-lp64-1.c: New test.
>         * gcc.dg/analyzer/asm-x86-lp64-2.c: New test.
>         * gcc.dg/analyzer/pr101570.c: New test.
>         * gcc.dg/analyzer/torture/asm-x86-linux-array_index_mask_nospec.c:
>         New test.
>         * gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-1.c: New
>         test.
>         * gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-2.c: New
>         test.
>         * gcc.dg/analyzer/torture/asm-x86-linux-cpuid.c: New test.
>         * gcc.dg/analyzer/torture/asm-x86-linux-rdmsr-paravirt.c: New
>         test.
>         * gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c: New test.
>         * gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-full.c:
>         New test.
>         * gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-reduced.c:
>         New test.
>
> Signed-off-by: David Malcolm <dmalcolm@redhat.com>
> ---
>  gcc/Makefile.in                               |   1 +
>  gcc/analyzer/analyzer.cc                      |   1 +
>  gcc/analyzer/analyzer.h                       |   2 +
>  gcc/analyzer/complexity.cc                    |  16 +
>  gcc/analyzer/complexity.h                     |   1 +
>  gcc/analyzer/engine.cc                        |   2 +
>  gcc/analyzer/region-model-asm.cc              | 303 +++++++++++++++++
>  gcc/analyzer/region-model-manager.cc          |  48 +++
>  gcc/analyzer/region-model.cc                  |   5 +-
>  gcc/analyzer/region-model.h                   |  13 +
>  gcc/analyzer/store.cc                         |  17 +
>  gcc/analyzer/store.h                          |   1 +
>  gcc/analyzer/svalue.cc                        |  89 +++++
>  gcc/analyzer/svalue.h                         | 145 +++++++-
>  gcc/testsuite/gcc.dg/analyzer/asm-x86-1.c     |  69 ++++
>  .../gcc.dg/analyzer/asm-x86-lp64-1.c          | 131 +++++++
>  .../gcc.dg/analyzer/asm-x86-lp64-2.c          |  34 ++
>  gcc/testsuite/gcc.dg/analyzer/pr101570.c      |   5 +
>  .../asm-x86-linux-array_index_mask_nospec.c   |  74 ++++
>  .../torture/asm-x86-linux-cpuid-paravirt-1.c  |  81 +++++
>  .../torture/asm-x86-linux-cpuid-paravirt-2.c  | 135 ++++++++
>  .../analyzer/torture/asm-x86-linux-cpuid.c    |  46 +++
>  .../torture/asm-x86-linux-rdmsr-paravirt.c    | 210 ++++++++++++
>  .../analyzer/torture/asm-x86-linux-rdmsr.c    |  33 ++
>  .../asm-x86-linux-wfx_get_ps_timeout-full.c   | 319 ++++++++++++++++++
>  ...asm-x86-linux-wfx_get_ps_timeout-reduced.c |  77 +++++
>  26 files changed, 1855 insertions(+), 3 deletions(-)
>  create mode 100644 gcc/analyzer/region-model-asm.cc
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/asm-x86-1.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-1.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/asm-x86-lp64-2.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr101570.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-array_index_mask_nospec.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-1.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid-paravirt-2.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-cpuid.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr-paravirt.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-full.c
>  create mode 100644 gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-reduced.c

I am checking in this.

Use unsigned long long for 64-bit integer since unsigned long is 32 bits
for x32.

* gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c (DECLARE_ARGS):
Use unsigned long long for x86-64.
---
 gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c
b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c
index 0a1c48f5800..69d0165aefe 100644
--- a/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c
@@ -6,7 +6,7 @@ 
 /* Adapted from Linux: arch/x86/include/asm/msr.h (GPL-2.0)  */

 #ifdef __x86_64__
-#define DECLARE_ARGS(val, low, high) unsigned long low, high
+#define DECLARE_ARGS(val, low, high) unsigned long long low, high
 #define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32)
 #define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high)
 #else