Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Assembly instructions "adrl, cpy, vmrs, vmsr" don't supported by Clang #41552

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR42582
Status NEW
Importance P enhancement
Reported by lol lol (qwertytmp1@gmail.com)
Reported on 2019-07-11 04:16:18 -0700
Last modified on 2019-07-12 03:12:40 -0700
Version 8.0
Hardware Other Linux
CC htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, qwertytmp1@gmail.com, richard-llvm@metafoo.co.uk, t.p.northover@gmail.com
Fixed by commit(s)
Attachments adrl_cpy_vmrs_vmsr.zip (636 bytes, application/x-zip-compressed)
Blocks
Blocked by
See also

Created attachment 22224 Test to reproduce situation

Assembly instructions "adrl, cpy, vmrs, vmsr" don't supported by Clang. At the same time, they are supported by GCC.

Environment information: OS: Ubuntu 16.04.5 LTS GCC: arm-linux-gnueabihf-gcc (Linaro GCC 6.2-2016.11) 6.2.1 20161016 CLANG: clang version 8.0.0 (tags/RELEASE_800/final)

Usecase is attached to this report. Also it is duplicated below in this text:

adrl_cpy_vmrs_vmsr.s

add:
adrl r0, add
cpy r0, r1
VMRS r2,FPEXC
VMSR FPEXC,r2

adrl_cpy_vmrs_vmsr.sh

#!/bin/bash

COMPILER_GCC=/opt/toolchains/aarch32/bin/arm-linux-gnueabihf-gcc
COMPILER_CLANG=opt/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/arm-funnyos-gnueabi-clang

i=adrl_cpy_vmrs_vmsr;

echo "======================================================================"
echo "Building by GCC";
echo "======================================================================"
${COMPILER_GCC} -c $i.s;
RESULT=$?
echo "----------------------------------------------------------------------"
echo "Build result: $RESULT";
echo "----------------------------------------------------------------------"
echo "";
echo "";

echo "======================================================================"
echo "Building by CLANG";
echo "======================================================================"
${COMPILER_CLANG} -c $i.s;
RESULT=$?
echo "----------------------------------------------------------------------"
echo "Build result: $RESULT";
echo "----------------------------------------------------------------------"
echo "";
echo "";

Result of "adrl_cpy_vmrs_vmsr.sh" execution:

$ ./adrl_cpy_vmrs_vmsr.sh 
======================================================================
Building by GCC
======================================================================
----------------------------------------------------------------------
Build result: 0
----------------------------------------------------------------------

======================================================================
Building by CLANG
======================================================================
adrl_cpy_vmrs_vmsr.s:2:1: error: invalid instruction, did you mean: adr?
adrl r0, add
^
adrl_cpy_vmrs_vmsr.s:3:1: error: invalid instruction, did you mean: cdp, cmp, cps?
cpy r0, r1
^
adrl_cpy_vmrs_vmsr.s:4:1: error: instruction requires: VFP2
VMRS r2,FPEXC
^
adrl_cpy_vmrs_vmsr.s:5:1: error: instruction requires: VFP2
VMSR FPEXC,r2
^
----------------------------------------------------------------------
Build result: 1
----------------------------------------------------------------------
Quuxplusone commented 5 years ago

Attached adrl_cpy_vmrs_vmsr.zip (636 bytes, application/x-zip-compressed): Test to reproduce situation

Quuxplusone commented 5 years ago

VMRS and VMSR are giving an error because Clang defaults to an early CPU without an FPU for arm-linux-gnueabi. If you need them you should specify a CPU or architecture on the command-line (actually, you probably should anyway).

ADRL and CPY are non-standard pseudo-instructions. CPY is particularly pointless because it's just MOV under a different name. ADRL at least does something different. I doubt either will be a high priority, so you're probably better off changing the source.

Quuxplusone commented 5 years ago

Thank you! Sorry, it was my fault to not specifying right target or -mfpu!

I agree with your opinion about cpy.

But how about adrl? Will it be implemented in the near future?

Quuxplusone commented 5 years ago

But how about adrl? Will it be implemented in the near future?

That seems unlikely, I'm afraid. I don't know of anyone who considers pseudos outside the official architecture reference a priority.

Quuxplusone commented 5 years ago

It's a pity...