1 ;; Cryptographic instructions added in ISA 2.07
2 ;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
3 ;; Contributed by Michael Meissner (meissner@linux.vnet.ibm.com)
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_c_enum "unspec"
31 ;; Iterator for VPMSUM/VPERMXOR
32 (define_mode_iterator CR_mode [V16QI V8HI V4SI V2DI])
34 (define_mode_attr CR_char [(V16QI "b")
39 ;; Iterator for VSHASIGMAD/VSHASIGMAW
40 (define_mode_iterator CR_hash [V4SI V2DI])
42 ;; Iterator for the other crypto functions
43 (define_int_iterator CR_code [UNSPEC_VCIPHER
48 (define_int_attr CR_insn [(UNSPEC_VCIPHER "vcipher")
49 (UNSPEC_VNCIPHER "vncipher")
50 (UNSPEC_VCIPHERLAST "vcipherlast")
51 (UNSPEC_VNCIPHERLAST "vncipherlast")])
53 ;; 2 operand crypto instructions
54 (define_insn "crypto_<CR_insn>"
55 [(set (match_operand:V2DI 0 "register_operand" "=v")
56 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v")
57 (match_operand:V2DI 2 "register_operand" "v")]
61 [(set_attr "type" "crypto")])
63 (define_insn "crypto_vpmsum<CR_char>"
64 [(set (match_operand:CR_mode 0 "register_operand" "=v")
65 (unspec:CR_mode [(match_operand:CR_mode 1 "register_operand" "v")
66 (match_operand:CR_mode 2 "register_operand" "v")]
69 "vpmsum<CR_char> %0,%1,%2"
70 [(set_attr "type" "crypto")])
72 ;; 3 operand crypto instructions
73 (define_insn "crypto_vpermxor_<mode>"
74 [(set (match_operand:CR_mode 0 "register_operand" "=v")
75 (unspec:CR_mode [(match_operand:CR_mode 1 "register_operand" "v")
76 (match_operand:CR_mode 2 "register_operand" "v")
77 (match_operand:CR_mode 3 "register_operand" "v")]
80 "vpermxor %0,%1,%2,%3"
81 [(set_attr "type" "crypto")])
83 ;; 1 operand crypto instruction
84 (define_insn "crypto_vsbox"
85 [(set (match_operand:V2DI 0 "register_operand" "=v")
86 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v")]
90 [(set_attr "type" "crypto")])
92 ;; Hash crypto instructions
93 (define_insn "crypto_vshasigma<CR_char>"
94 [(set (match_operand:CR_hash 0 "register_operand" "=v")
95 (unspec:CR_hash [(match_operand:CR_hash 1 "register_operand" "v")
96 (match_operand:SI 2 "const_0_to_1_operand" "n")
97 (match_operand:SI 3 "const_0_to_15_operand" "n")]
100 "vshasigma<CR_char> %0,%1,%2,%3"
101 [(set_attr "type" "crypto")])