Menu

#2443 SPARC is not recognized as 64bit CPU

None
open-accepted
nobody
None
5
2024-01-26
2024-01-25
No

SPARC should be recognized as a 64-bit CPU. Nothing seems to break with or without this patch.

1 Attachments

Discussion

  • Igor Pavlov

    Igor Pavlov - 2024-01-25

    if sparc-v9 supports __ILP32__ then we need more complicated code:

    #if  defined(__sparc__) 
      #define MY_CPU_SPARC
      #if defined(__sparcv9)
        #define MY_CPU_64BIT
      #ifdef __ILP32__
        #define MY_CPU_NAME "sparcv9-32"
        #define MY_CPU_SIZEOF_POINTER 4
      #else
        #define MY_CPU_NAME "sparcv9"
        #define MY_CPU_SIZEOF_POINTER 8
      #endif
      #else
        #define MY_CPU_NAME "sparc"
        #define MY_CPU_SIZEOF_POINTER 4
      #endif
    #endif
    
     
    • Petr Sumbera

      Petr Sumbera - 2024-01-25

      No, __sparcv9 means it's just 64 bits. We can eventually use __LP64__ instead of __sparcv9.

       

      Last edit: Petr Sumbera 2024-01-25
  • Igor Pavlov

    Igor Pavlov - 2024-01-25
    • status: open --> open-accepted
    • Group: -->
     
  • Igor Pavlov

    Igor Pavlov - 2024-01-25

    Problem case is __ILP32__.
    where pointers are 32-bit, but registers can be 64-bit still and we can have all other new isa features.
    So the question is: does sparc systems/compilers support __ILP32__ for sparc-v9?

     
  • mik

    mik - 2024-01-25
    % sparc-linux-cpp -m32 -dM /dev/null | egrep -i '(sparc|lp)'
    #define sparc 1
    #define __sparc__ 1
    #define __sparc 1
    #define __sparc_v8__ 1
    % sparc-linux-cpp -m32 -mcpu=ultrasparc -dM /dev/null | egrep -i '(sparc|lp)'
    #define sparc 1
    #define __sparc__ 1
    #define __sparc 1
    #define __sparc_v9__ 1
    % sparc-linux-cpp -m64 -dM /dev/null | egrep -i '(sparc|lp)'
    #define sparc 1
    #define __sparc__ 1
    #define __LP64__ 1
    #define __sparc 1
    #define _LP64 1
    
     
  • Igor Pavlov

    Igor Pavlov - 2024-01-26
    #if   defined(__sparc__) \
       || defined(__sparc) 
      #define MY_CPU_SPARC
      #if  defined(__LP64__) \
        || defined(_LP64) \
        || defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 8)
        #define MY_CPU_NAME "sparcv9"
        #define MY_CPU_SIZEOF_POINTER 8
        #define MY_CPU_64BIT
      #elif defined(__sparc_v9__) \
         || defined(__sparcv9)
        #define MY_CPU_64BIT
        #if defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 4)
          #define MY_CPU_NAME "sparcv9-32"
        #else
          #define MY_CPU_NAME "sparcv9m"
        #endif
      #elif defined(__sparc_v8__) \
         || defined(__sparcv8)
        #define MY_CPU_NAME "sparcv8"
        #define MY_CPU_SIZEOF_POINTER 4
      #else
        #define MY_CPU_NAME "sparc"
      #endif
    #endif
    
     
  • Petr Sumbera

    Petr Sumbera - 2024-01-26

    Just for record what I get for latest Solaris. But anyway these days only 64bits matter.

    $ echo | gcc -m32 -dM -E -| egrep -i '(sparc|lp|__SIZEOF_POINTER__)'
    #define sparc 1
    #define __sparc__ 1
    #define __SIZEOF_POINTER__ 4
    #define __sparc 1
    $ echo | gcc -m32 -mcpu=ultrasparc -dM -E -| egrep -i '(sparc|lp|__SIZEOF_POINTER__)'
    #define sparc 1
    #define __sparcv8 1
    #define __sparc__ 1
    #define __SIZEOF_POINTER__ 4
    #define __sparc 1
    $ echo | gcc -m64 -mcpu=ultrasparc -dM -E -| egrep -i '(sparc|lp|__SIZEOF_POINTER__)'
    #define sparc 1
    #define __sparc__ 1
    #define __SIZEOF_POINTER__ 8
    #define __LP64__ 1
    #define __sparcv9 1
    #define __sparc 1
    #define _LP64 1
    
     

Log in to post a comment.