PR target/115751: Avoid force_reg in ix86_expand_ternlog.
[official-gcc.git] / gcc / config / riscv / thead-peephole.md
blob6627ad628ba68ac1237dced790f3ebd80a9640f3
1 ;; Machine description for T-Head vendor extensions
2 ;; Copyright (C) 2023-2024 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 3, or (at your option)
9 ;; any later version.
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3.  If not see
18 ;; <http://www.gnu.org/licenses/>.
20 ;; XTheadMemPair: merge two SI or DI loads
21 (define_peephole2
22   [(set (match_operand:GPR 0 "register_operand" "")
23         (match_operand:GPR 1 "memory_operand" ""))
24    (set (match_operand:GPR 2 "register_operand" "")
25         (match_operand:GPR 3 "memory_operand" ""))]
26   "TARGET_XTHEADMEMPAIR
27   && th_mempair_operands_p (operands, true, <GPR:MODE>mode)"
28   [(parallel [(set (match_dup 0) (match_dup 1))
29                   (set (match_dup 2) (match_dup 3))])]
31   th_mempair_order_operands (operands, true, <GPR:MODE>mode);
34 ;; XTheadMemPair: merge two SI or DI stores
35 (define_peephole2
36   [(set (match_operand:GPR 0 "memory_operand" "")
37         (match_operand:GPR 1 "register_operand" ""))
38    (set (match_operand:GPR 2 "memory_operand" "")
39         (match_operand:GPR 3 "register_operand" ""))]
40   "TARGET_XTHEADMEMPAIR
41   && th_mempair_operands_p (operands, false, <GPR:MODE>mode)"
42   [(parallel [(set (match_dup 0) (match_dup 1))
43               (set (match_dup 2) (match_dup 3))])]
45   th_mempair_order_operands (operands, false, <GPR:MODE>mode);
48 ;; XTheadMemPair: merge two SI loads with sign-extension
49 (define_peephole2
50   [(set (match_operand:DI 0 "register_operand" "")
51         (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))
52    (set (match_operand:DI 2 "register_operand" "")
53         (sign_extend:DI (match_operand:SI 3 "memory_operand" "")))]
54   "TARGET_XTHEADMEMPAIR && TARGET_64BIT
55   && th_mempair_operands_p (operands, true, SImode)"
56   [(parallel [(set (match_dup 0) (sign_extend:DI (match_dup 1)))
57               (set (match_dup 2) (sign_extend:DI (match_dup 3)))])]
59   th_mempair_order_operands (operands, true, SImode);
62 ;; XTheadMemPair: merge two SI loads with zero-extension
63 (define_peephole2
64   [(set (match_operand:DI 0 "register_operand" "")
65         (zero_extend:DI (match_operand:SI 1 "memory_operand" "")))
66    (set (match_operand:DI 2 "register_operand" "")
67         (zero_extend:DI (match_operand:SI 3 "memory_operand" "")))]
68   "TARGET_XTHEADMEMPAIR && TARGET_64BIT
69   && th_mempair_operands_p (operands, true, SImode)"
70   [(parallel [(set (match_dup 0) (zero_extend:DI (match_dup 1)))
71               (set (match_dup 2) (zero_extend:DI (match_dup 3)))])]
73   th_mempair_order_operands (operands, true, SImode);