Skip to content

error: invalid instruction, mffprwz ... #15413

@kuzi117

Description

@kuzi117
System information (version)
  • OpenCV => master, 834c992
  • Operating System / Platform => Ubuntu 18.04, Power 9
  • Compiler => clang version 10.0.0 (git@github.com:llvm/llvm-project.git 2f51a43f8c2b117e69a45eae6a7c849e035a793b)
Detailed description
In file included from .../opencv/modules/core/src/arithm.cpp:50:
In file included from .../opencv/modules/core/src/precomp.hpp:49:
In file included from .../opencv/modules/core/include/opencv2/core/utility.hpp:56:
In file included from .../opencv/modules/core/include/opencv2/core.hpp:57:
In file included from .../opencv/modules/core/include/opencv2/core/matx.hpp:54:
In file included from .../opencv/modules/core/include/opencv2/core/saturate.hpp:49:         
.../opencv/modules/core/include/opencv2/core/fast_math.hpp:200:5: error: invalid instruction
    CV_INLINE_ROUND_DBL(value);                      
    ^                                                
.../opencv/modules/core/include/opencv2/core/fast_math.hpp:105:40: note: expanded from macro 'CV_INLINE_ROUND_DBL'
        __asm__( "fctiw %[temp],%[in]\n\tmffprwz %[out],%[temp]\n\t" : [out] "=r" (out), [temp] "=d" (temp) : [in] "d" ((double)(value)) : ); \
                                       ^
<inline asm>:2:2: note: instantiated into assembly here
        mffprwz 4,0                                                                                                                             
        ^~~~~~~

After investigating the most recent Power ISA (March 29, 2017. Page 131 of the pdf or 113 of the document) mffprwz is a mnemonic for mfvsrwz. Specifically:

Extended Mnemonics        Equivalent To
mffprwz      RA,FRS       mfvsrwz      RA,FRS
mfvrwz       RA,VRS       mfvsrwz      RA,VRS+32

After investigating clang, it does not implement mffprwz, instead only mfvsrwz. I will be passing this along to the llvm project as well but we can fix this here as well, probably faster. I've prepared a patch to follow as well.

Steps to reproduce
  1. Checkout opencv.
  2. Make build directory.
  3. cmake <path to source> -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
  4. make -j###
  5. Receive above error message.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions