Merge from trunk
[official-gcc.git] / gcc / config / arm / crypto.md
blob9f249803d22aafd8a911375f0116c37e59d19dae
1 ;; ARMv8-A crypto patterns.
2 ;; Copyright (C) 2013-2014 Free Software Foundation, Inc.
3 ;; Contributed by ARM Ltd.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 3, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3.  If not see
19 ;; <http://www.gnu.org/licenses/>.
21 (define_insn "crypto_<crypto_pattern>"
22   [(set (match_operand:<crypto_mode> 0 "register_operand" "=w")
23         (unspec:<crypto_mode> [(match_operand:<crypto_mode> 1
24                        "register_operand" "w")]
25          CRYPTO_UNARY))]
26   "TARGET_CRYPTO"
27   "<crypto_pattern>.<crypto_size_sfx>\\t%q0, %q1"
28   [(set_attr "type" "<crypto_type>")]
31 (define_insn "crypto_<crypto_pattern>"
32   [(set (match_operand:<crypto_mode> 0 "register_operand" "=w")
33         (unspec:<crypto_mode> [(match_operand:<crypto_mode> 1 "register_operand" "0")
34                       (match_operand:<crypto_mode> 2 "register_operand" "w")]
35          CRYPTO_BINARY))]
36   "TARGET_CRYPTO"
37   "<crypto_pattern>.<crypto_size_sfx>\\t%q0, %q2"
38   [(set_attr "type" "<crypto_type>")]
41 (define_insn "crypto_<crypto_pattern>"
42   [(set (match_operand:<crypto_mode> 0 "register_operand" "=w")
43         (unspec:<crypto_mode> [(match_operand:<crypto_mode> 1 "register_operand" "0")
44                       (match_operand:<crypto_mode> 2 "register_operand" "w")
45                       (match_operand:<crypto_mode> 3 "register_operand" "w")]
46          CRYPTO_TERNARY))]
47   "TARGET_CRYPTO"
48   "<crypto_pattern>.<crypto_size_sfx>\\t%q0, %q2, %q3"
49   [(set_attr "type" "<crypto_type>")]
52 (define_insn "crypto_sha1h"
53   [(set (match_operand:V4SI 0 "register_operand" "=w")
54         (zero_extend:V4SI
55           (unspec:SI [(vec_select:SI
56                         (match_operand:V4SI 1 "register_operand" "w")
57                         (parallel [(match_operand:SI 2 "immediate_operand" "i")]))]
58            UNSPEC_SHA1H)))]
59   "TARGET_CRYPTO"
60   "sha1h.32\\t%q0, %q1"
61   [(set_attr "type" "crypto_sha1_fast")]
64 (define_insn "crypto_vmullp64"
65   [(set (match_operand:TI 0 "register_operand" "=w")
66         (unspec:TI [(match_operand:DI 1 "register_operand" "w")
67                     (match_operand:DI 2 "register_operand" "w")]
68          UNSPEC_VMULLP64))]
69   "TARGET_CRYPTO"
70   "vmull.p64\\t%q0, %P1, %P2"
71   [(set_attr "type" "neon_mul_d_long")]
74 (define_insn "crypto_<crypto_pattern>"
75   [(set (match_operand:V4SI 0 "register_operand" "=w")
76         (unspec:<crypto_mode>
77                      [(match_operand:<crypto_mode> 1 "register_operand" "0")
78                       (vec_select:SI
79                         (match_operand:<crypto_mode> 2 "register_operand" "w")
80                         (parallel [(match_operand:SI 4 "immediate_operand" "i")]))
81                       (match_operand:<crypto_mode> 3 "register_operand" "w")]
82          CRYPTO_SELECTING))]
83   "TARGET_CRYPTO"
84   "<crypto_pattern>.<crypto_size_sfx>\\t%q0, %q2, %q3"
85   [(set_attr "type" "<crypto_type>")]