]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
bpf: neg instruction does not accept an immediate
authorDavid Faust <david.faust@oracle.com>
Mon, 21 Aug 2023 20:34:08 +0000 (13:34 -0700)
committerDavid Faust <david.faust@oracle.com>
Mon, 21 Aug 2023 22:10:28 +0000 (15:10 -0700)
The BPF virtual machine does not support neg nor neg32 instructions with
an immediate.

The erroneous instructions were removed from binutils:
https://sourceware.org/pipermail/binutils/2023-August/129135.html

Change the define_insn so that an immediate cannot be accepted.

From testing, a neg-immediate was probably never chosen over a
mov-immediate anyway.

gcc/

* config/bpf/bpf.md (neg): Second operand must be a register.

gcc/config/bpf/bpf.md

index a64de1095eda3a9d55190843f7694468d114d11f..e87d72182bb82e46d665258b79ffb4e3fc583d11 100644 (file)
 
 ;;; Negation
 (define_insn "neg<AM:mode>2"
-  [(set (match_operand:AM         0 "register_operand"   "=r,r")
-        (neg:AM (match_operand:AM 1 "reg_or_imm_operand" " 0,I")))]
+  [(set (match_operand:AM         0 "register_operand" "=r")
+        (neg:AM (match_operand:AM 1 "register_operand" " 0")))]
   ""
   "{neg<msuffix>\t%0|%w0 = -%w1}"
   [(set_attr "type" "<mtype>")])