;; AMO ops
(define_insn "atomic_<atomic_optab><mode>"
- [(set (match_operand:SHORT 0 "memory_operand" "+A")
+ [(set (match_operand:SHORT 0 "riscv_atomic_memory_operand" "+A")
(unspec_volatile:SHORT
[(any_atomic:SHORT (match_dup 0)
(match_operand:SHORT 1 "reg_or_0_operand" "rJ"))
(set (attr "length") (const_int 4))])
(define_expand "atomic_<atomic_optab><mode>"
- [(any_atomic:GPR (match_operand:GPR 0 "memory_operand") ;; mem location
+ [(any_atomic:GPR (match_operand:GPR 0 "riscv_atomic_memory_operand") ;; mem location
(match_operand:GPR 1 "reg_or_0_operand")) ;; value for op
(match_operand:SI 2 "const_int_operand")] ;; model
"TARGET_ZAAMO || TARGET_ZALRSC"
})
(define_insn "amo_atomic_<atomic_optab><mode>"
- [(set (match_operand:GPR 0 "memory_operand" "+A")
+ [(set (match_operand:GPR 0 "riscv_atomic_memory_operand" "+A")
(unspec_volatile:GPR
[(any_atomic:GPR (match_dup 0)
(match_operand:GPR 1 "reg_or_0_operand" "rJ"))
(set (attr "length") (const_int 4))])
(define_insn "lrsc_atomic_<atomic_optab><mode>"
- [(set (match_operand:GPR 0 "memory_operand" "+A")
+ [(set (match_operand:GPR 0 "riscv_atomic_memory_operand" "+A")
(unspec_volatile:GPR
[(any_atomic:GPR (match_dup 0)
(match_operand:GPR 1 "reg_or_0_operand" "rJ"))
(define_expand "atomic_fetch_<atomic_optab><mode>"
[(match_operand:GPR 0 "register_operand") ;; old value at mem
- (any_atomic:GPR (match_operand:GPR 1 "memory_operand") ;; mem location
+ (any_atomic:GPR (match_operand:GPR 1 "riscv_atomic_memory_operand") ;; mem location
(match_operand:GPR 2 "reg_or_0_operand")) ;; value for op
(match_operand:SI 3 "const_int_operand")] ;; model
"TARGET_ZAAMO || TARGET_ZALRSC"
(define_insn "amo_atomic_fetch_<atomic_optab><mode>"
[(set (match_operand:GPR 0 "register_operand" "=&r")
- (match_operand:GPR 1 "memory_operand" "+A"))
+ (match_operand:GPR 1 "riscv_atomic_memory_operand" "+A"))
(set (match_dup 1)
(unspec_volatile:GPR
[(any_atomic:GPR (match_dup 1)
(define_insn "lrsc_atomic_fetch_<atomic_optab><mode>"
[(set (match_operand:GPR 0 "register_operand" "=&r")
- (match_operand:GPR 1 "memory_operand" "+A"))
+ (match_operand:GPR 1 "riscv_atomic_memory_operand" "+A"))
(set (match_dup 1)
(unspec_volatile:GPR
[(any_atomic:GPR (match_dup 1)
(define_insn "subword_atomic_fetch_strong_<atomic_optab>"
[(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
- (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
+ (match_operand:SI 1 "riscv_atomic_memory_operand" "+A")) ;; mem location
(set (match_dup 1)
(unspec_volatile:SI
[(any_atomic:SI (match_dup 1)
(define_expand "atomic_fetch_nand<mode>"
[(match_operand:SHORT 0 "register_operand") ;; old value at mem
- (not:SHORT (and:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location
+ (not:SHORT (and:SHORT (match_operand:SHORT 1 "riscv_atomic_memory_operand") ;; mem location
(match_operand:SHORT 2 "reg_or_0_operand"))) ;; value for op
(match_operand:SI 3 "const_int_operand")] ;; model
"TARGET_ZALRSC && TARGET_INLINE_SUBWORD_ATOMIC"
(define_insn "subword_atomic_fetch_strong_nand"
[(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
- (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
+ (match_operand:SI 1 "riscv_atomic_memory_operand" "+A")) ;; mem location
(set (match_dup 1)
(unspec_volatile:SI
[(not:SI (and:SI (match_dup 1)
(define_expand "atomic_fetch_<atomic_optab><mode>"
[(match_operand:SHORT 0 "register_operand") ;; old value at mem
- (any_atomic:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location
+ (any_atomic:SHORT (match_operand:SHORT 1 "riscv_atomic_memory_operand") ;; mem location
(match_operand:SHORT 2 "reg_or_0_operand")) ;; value for op
(match_operand:SI 3 "const_int_operand")] ;; model
"(TARGET_ZALRSC && TARGET_INLINE_SUBWORD_ATOMIC) || TARGET_ZABHA"
(define_insn "zabha_atomic_fetch_<atomic_optab><mode>"
[(set (match_operand:SHORT 0 "register_operand" "=&r")
- (match_operand:SHORT 1 "memory_operand" "+A"))
+ (match_operand:SHORT 1 "riscv_atomic_memory_operand" "+A"))
(set (match_dup 1)
(unspec_volatile:SHORT
[(any_atomic:SHORT (match_dup 1)
(define_expand "lrsc_atomic_fetch_<atomic_optab><mode>"
[(match_operand:SHORT 0 "register_operand") ;; old value at mem
- (any_atomic:SHORT (match_operand:SHORT 1 "memory_operand") ;; mem location
+ (any_atomic:SHORT (match_operand:SHORT 1 "riscv_atomic_memory_operand") ;; mem location
(match_operand:SHORT 2 "reg_or_0_operand")) ;; value for op
(match_operand:SI 3 "const_int_operand")] ;; model
"!TARGET_ZABHA && TARGET_ZALRSC && TARGET_INLINE_SUBWORD_ATOMIC"
(define_expand "atomic_exchange<mode>"
[(match_operand:GPR 0 "register_operand") ;; old value at mem
- (match_operand:GPR 1 "memory_operand") ;; mem location
+ (match_operand:GPR 1 "riscv_atomic_memory_operand") ;; mem location
(match_operand:GPR 2 "register_operand") ;; value for op
(match_operand:SI 3 "const_int_operand")] ;; model
"TARGET_ZAAMO || TARGET_ZALRSC"
(define_insn "amo_atomic_exchange<mode>"
[(set (match_operand:GPR 0 "register_operand" "=r")
(unspec_volatile:GPR
- [(match_operand:GPR 1 "memory_operand" "+A")
+ [(match_operand:GPR 1 "riscv_atomic_memory_operand" "+A")
(match_operand:SI 3 "const_int_operand")] ;; model
UNSPECV_SYNC_EXCHANGE))
(set (match_dup 1)
(define_insn "amo_atomic_exchange_extended"
[(set (match_operand:DI 0 "register_operand" "=r")
(sign_extend:DI (unspec_volatile:SI
- [(match_operand:SI 1 "memory_operand" "+A")
+ [(match_operand:SI 1 "riscv_atomic_memory_operand" "+A")
(match_operand:SI 3 "const_int_operand")] ;; model
UNSPECV_SYNC_EXCHANGE)))
(set (match_dup 1)
(define_insn "lrsc_atomic_exchange<mode>"
[(set (match_operand:GPR 0 "register_operand" "=&r")
(unspec_volatile:GPR
- [(match_operand:GPR 1 "memory_operand" "+A")
+ [(match_operand:GPR 1 "riscv_atomic_memory_operand" "+A")
(match_operand:SI 3 "const_int_operand")] ;; model
UNSPECV_SYNC_EXCHANGE))
(set (match_dup 1)
(define_expand "atomic_exchange<mode>"
[(match_operand:SHORT 0 "register_operand") ;; old value at mem
- (match_operand:SHORT 1 "memory_operand") ;; mem location
+ (match_operand:SHORT 1 "riscv_atomic_memory_operand") ;; mem location
(match_operand:SHORT 2 "register_operand") ;; value
(match_operand:SI 3 "const_int_operand")] ;; model
"(TARGET_ZALRSC && TARGET_INLINE_SUBWORD_ATOMIC) || TARGET_ZABHA"
(define_insn "zabha_atomic_exchange<mode>"
[(set (match_operand:SHORT 0 "register_operand" "=r")
(unspec_volatile:SHORT
- [(match_operand:SHORT 1 "memory_operand" "+A")
+ [(match_operand:SHORT 1 "riscv_atomic_memory_operand" "+A")
(match_operand:SI 3 "const_int_operand")] ;; model
UNSPECV_SYNC_EXCHANGE_ZABHA))
(set (match_dup 1)
(define_expand "lrsc_atomic_exchange<mode>"
[(match_operand:SHORT 0 "register_operand") ;; old value at mem
- (match_operand:SHORT 1 "memory_operand") ;; mem location
+ (match_operand:SHORT 1 "riscv_atomic_memory_operand") ;; mem location
(match_operand:SHORT 2 "register_operand") ;; value
(match_operand:SI 3 "const_int_operand")] ;; model
"!TARGET_ZABHA && TARGET_ZALRSC && TARGET_INLINE_SUBWORD_ATOMIC"
(define_insn "subword_atomic_exchange_strong"
[(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
- (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
+ (match_operand:SI 1 "riscv_atomic_memory_operand" "+A")) ;; mem location
(set (match_dup 1)
(unspec_volatile:SI
[(match_operand:SI 2 "arith_operand" "rI") ;; value
;; More details: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/444
(define_insn "zacas_atomic_cas_value_strong<mode>"
[(set (match_operand:GPR 0 "register_operand" "=&r") ;; val output
- (match_operand:GPR 1 "memory_operand" "+A")) ;; memory
+ (match_operand:GPR 1 "riscv_atomic_memory_operand" "+A")) ;; memory
(set (match_dup 1)
(unspec_volatile:GPR [(match_operand:GPR 2 "register_operand" "0") ;; expected val
(match_operand:GPR 3 "reg_or_0_operand" "rJ") ;; desired val
(define_insn "zalrsc_atomic_cas_value_strong<mode>"
[(set (match_operand:GPR 0 "register_operand" "=&r")
- (match_operand:GPR 1 "memory_operand" "+A"))
+ (match_operand:GPR 1 "riscv_atomic_memory_operand" "+A"))
(set (match_dup 1)
(unspec_volatile:GPR [(match_operand:GPR 2 "reg_or_0_operand" "rJ")
(match_operand:GPR 3 "reg_or_0_operand" "rJ")
(define_expand "atomic_compare_and_swap<mode>"
[(match_operand:SI 0 "register_operand" "") ;; bool output
(match_operand:GPR 1 "register_operand" "") ;; val output
- (match_operand:GPR 2 "memory_operand" "") ;; memory
+ (match_operand:GPR 2 "riscv_atomic_memory_operand" "") ;; memory
(match_operand:GPR 3 "register_operand" "") ;; expected value
(match_operand:GPR 4 "reg_or_0_operand" "") ;; desired value
(match_operand:SI 5 "const_int_operand" "") ;; is_weak
;; More details: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/444
(define_insn "zacas_atomic_cas_value_strong<mode>"
[(set (match_operand:SHORT 0 "register_operand" "=&r") ;; val output
- (match_operand:SHORT 1 "memory_operand" "+A")) ;; memory
+ (match_operand:SHORT 1 "riscv_atomic_memory_operand" "+A")) ;; memory
(set (match_dup 1)
(unspec_volatile:SHORT [(match_operand:SHORT 2 "register_operand" "0") ;; expected_val
(match_operand:SHORT 3 "reg_or_0_operand" "rJ") ;; desired_val
(define_expand "atomic_compare_and_swap<mode>"
[(match_operand:SI 0 "register_operand") ;; bool output
(match_operand:SHORT 1 "register_operand") ;; val output
- (match_operand:SHORT 2 "memory_operand") ;; memory
+ (match_operand:SHORT 2 "riscv_atomic_memory_operand") ;; memory
(match_operand:SHORT 3 "register_operand") ;; expected value
(match_operand:SHORT 4 "reg_or_0_operand") ;; desired value
(match_operand:SI 5 "const_int_operand") ;; is_weak
(define_expand "zalrsc_atomic_cas_value_strong<mode>"
[(match_operand:SHORT 0 "register_operand") ;; val output
- (match_operand:SHORT 1 "memory_operand") ;; memory
+ (match_operand:SHORT 1 "riscv_atomic_memory_operand") ;; memory
(match_operand:SHORT 2 "reg_or_0_operand") ;; expected value
(match_operand:SHORT 3 "reg_or_0_operand") ;; desired value
(match_operand:SI 4 "const_int_operand") ;; mod_s
(define_insn "subword_atomic_cas_strong"
[(set (match_operand:SI 0 "register_operand" "=&r") ;; old value at mem
- (match_operand:SI 1 "memory_operand" "+A")) ;; mem location
+ (match_operand:SI 1 "riscv_atomic_memory_operand" "+A")) ;; mem location
(set (match_dup 1)
(unspec_volatile:SI [(match_operand:SI 2 "reg_or_0_operand" "rJ") ;; expected value
(match_operand:SI 3 "arith_operand" "rI")] ;; desired value
(define_expand "atomic_test_and_set"
[(match_operand:QI 0 "register_operand" "") ;; bool output
- (match_operand:QI 1 "memory_operand" "+A") ;; memory
+ (match_operand:QI 1 "riscv_atomic_memory_operand" "+A") ;; memory
(match_operand:SI 2 "const_int_operand" "")] ;; model
"TARGET_ZAAMO || TARGET_ZALRSC"
{