Fix build on sparc64-linux-gnu.
[official-gcc.git] / gcc / config / nds32 / nds32-intrinsic.c
blobc2ad927b05dcc63ffbbd4b3535309091023570cb
1 /* Intrinsic functions of Andes NDS32 cpu for GNU compiler
2 Copyright (C) 2012-2018 Free Software Foundation, Inc.
3 Contributed by Andes Technology Corporation.
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 /* ------------------------------------------------------------------------ */
23 #define IN_TARGET_CODE 1
25 #include "config.h"
26 #include "system.h"
27 #include "coretypes.h"
28 #include "backend.h"
29 #include "target.h"
30 #include "rtl.h"
31 #include "memmodel.h"
32 #include "emit-rtl.h"
33 #include "tree.h"
34 #include "memmodel.h"
35 #include "optabs.h" /* For GEN_FCN. */
36 #include "diagnostic-core.h"
37 #include "stor-layout.h"
38 #include "expr.h"
39 #include "langhooks.h" /* For add_builtin_function(). */
40 #include "recog.h"
41 #include "explow.h"
43 /* ------------------------------------------------------------------------ */
45 /* Read the requested argument from the EXP given by INDEX.
46 Return the value as an rtx. */
47 static rtx
48 nds32_read_argument (tree exp, unsigned int index)
50 return expand_normal (CALL_EXPR_ARG (exp, index));
53 /* Return a legitimate rtx for instruction ICODE's return value. Use TARGET
54 if it's not null, has the right mode, and satisfies operand 0's
55 predicate. */
56 static rtx
57 nds32_legitimize_target (enum insn_code icode, rtx target)
59 enum machine_mode mode = insn_data[icode].operand[0].mode;
61 if (! target
62 || GET_MODE (target) != mode
63 || ! (*insn_data[icode].operand[0].predicate) (target, mode))
64 return gen_reg_rtx (mode);
65 else
66 return target;
69 /* Given that ARG is being passed as operand OPNUM to instruction ICODE,
70 check whether ARG satisfies the operand's constraints. If it doesn't,
71 copy ARG to a temporary register and return that. Otherwise return ARG
72 itself. */
73 static rtx
74 nds32_legitimize_argument (enum insn_code icode, int opnum, rtx arg)
76 enum machine_mode mode = insn_data[icode].operand[opnum].mode;
78 if ((*insn_data[icode].operand[opnum].predicate) (arg, mode))
79 return arg;
80 else if (VECTOR_MODE_P (mode) && CONST_INT_P (arg))
82 /* Handle CONST_INT covert to CONST_VECTOR. */
83 int nunits = GET_MODE_NUNITS (mode);
84 int i, shift = 0;
85 rtvec v = rtvec_alloc (nunits);
86 int val = INTVAL (arg);
87 enum machine_mode val_mode = (mode == V4QImode) ? QImode : HImode;
88 int shift_acc = (val_mode == QImode) ? 8 : 16;
89 int mask = (val_mode == QImode) ? 0xff : 0xffff;
90 int tmp_val = val;
92 if (TARGET_BIG_ENDIAN)
93 for (i = 0; i < nunits; i++)
95 tmp_val = (val >> shift) & mask;
96 RTVEC_ELT (v, nunits - i - 1) = gen_int_mode (tmp_val, val_mode);
97 shift += shift_acc;
99 else
100 for (i = 0; i < nunits; i++)
102 tmp_val = (val >> shift) & mask;
103 RTVEC_ELT (v, i) = gen_int_mode (tmp_val, val_mode);
104 shift += shift_acc;
107 return copy_to_mode_reg (mode, gen_rtx_CONST_VECTOR (mode, v));
109 else
111 rtx tmp_rtx = gen_reg_rtx (mode);
112 convert_move (tmp_rtx, arg, false);
113 return tmp_rtx;
117 /* Return true if OPVAL can be used for operand OPNUM of instruction ICODE.
118 The instruction should require a constant operand of some sort. The
119 function prints an error if OPVAL is not valid. */
120 static int
121 nds32_check_constant_argument (enum insn_code icode, int opnum, rtx opval,
122 const char *name)
124 if (GET_CODE (opval) != CONST_INT)
126 error ("invalid argument to built-in function %s", name);
127 return false;
129 if (! (*insn_data[icode].operand[opnum].predicate) (opval, VOIDmode))
131 error ("constant argument out of range for %s", name);
133 return false;
135 return true;
138 /* Expand builtins that return target. */
139 static rtx
140 nds32_expand_noarg_builtin (enum insn_code icode, rtx target)
142 rtx pat;
144 target = nds32_legitimize_target (icode, target);
146 /* Emit and return the new instruction. */
147 pat = GEN_FCN (icode) (target);
148 if (! pat)
149 return NULL_RTX;
151 emit_insn (pat);
152 return target;
155 /* Expand builtins that take one operand. */
156 static rtx
157 nds32_expand_unop_builtin (enum insn_code icode, tree exp, rtx target,
158 bool return_p)
160 rtx pat;
161 rtx op0 = nds32_read_argument (exp, 0);
162 int op0_num = return_p ? 1 : 0;
164 if (return_p)
165 target = nds32_legitimize_target (icode, target);
167 op0 = nds32_legitimize_argument (icode, op0_num, op0);
169 /* Emit and return the new instruction. */
170 if (return_p)
171 pat = GEN_FCN (icode) (target, op0);
172 else
173 pat = GEN_FCN (icode) (op0);
175 if (! pat)
176 return NULL_RTX;
178 emit_insn (pat);
179 return target;
182 /* Expand builtins that take one operands and the first is immediate. */
183 static rtx
184 nds32_expand_unopimm_builtin (enum insn_code icode, tree exp, rtx target,
185 bool return_p, const char *name)
187 rtx pat;
188 rtx op0 = nds32_read_argument (exp, 0);
189 int op0_num = return_p ? 1 : 0;
191 if (return_p)
192 target = nds32_legitimize_target (icode, target);
194 if (!nds32_check_constant_argument (icode, op0_num, op0, name))
195 return NULL_RTX;
197 op0 = nds32_legitimize_argument (icode, op0_num, op0);
199 /* Emit and return the new instruction. */
200 if (return_p)
201 pat = GEN_FCN (icode) (target, op0);
202 else
203 pat = GEN_FCN (icode) (op0);
205 if (! pat)
206 return NULL_RTX;
208 emit_insn (pat);
209 return target;
212 /* Expand builtins that take two operands. */
213 static rtx
214 nds32_expand_binop_builtin (enum insn_code icode, tree exp, rtx target,
215 bool return_p)
217 rtx pat;
218 rtx op0 = nds32_read_argument (exp, 0);
219 rtx op1 = nds32_read_argument (exp, 1);
220 int op0_num = return_p ? 1 : 0;
221 int op1_num = return_p ? 2 : 1;
223 if (return_p)
224 target = nds32_legitimize_target (icode, target);
226 op0 = nds32_legitimize_argument (icode, op0_num, op0);
227 op1 = nds32_legitimize_argument (icode, op1_num, op1);
229 /* Emit and return the new instruction. */
230 if (return_p)
231 pat = GEN_FCN (icode) (target, op0, op1);
232 else
233 pat = GEN_FCN (icode) (op0, op1);
235 if (! pat)
236 return NULL_RTX;
238 emit_insn (pat);
239 return target;
242 /* Expand builtins that take two operands and the second is immediate. */
243 static rtx
244 nds32_expand_binopimm_builtin (enum insn_code icode, tree exp, rtx target,
245 bool return_p, const char *name)
247 rtx pat;
248 rtx op0 = nds32_read_argument (exp, 0);
249 rtx op1 = nds32_read_argument (exp, 1);
250 int op0_num = return_p ? 1 : 0;
251 int op1_num = return_p ? 2 : 1;
253 if (return_p)
254 target = nds32_legitimize_target (icode, target);
256 if (!nds32_check_constant_argument (icode, op1_num, op1, name))
257 return NULL_RTX;
259 op0 = nds32_legitimize_argument (icode, op0_num, op0);
260 op1 = nds32_legitimize_argument (icode, op1_num, op1);
262 /* Emit and return the new instruction. */
263 if (return_p)
264 pat = GEN_FCN (icode) (target, op0, op1);
265 else
266 pat = GEN_FCN (icode) (op0, op1);
268 if (! pat)
269 return NULL_RTX;
271 emit_insn (pat);
272 return target;
275 /* Expand builtins that take three operands. */
276 static rtx
277 nds32_expand_triop_builtin (enum insn_code icode, tree exp, rtx target,
278 bool return_p)
280 rtx pat;
281 rtx op0 = nds32_read_argument (exp, 0);
282 rtx op1 = nds32_read_argument (exp, 1);
283 rtx op2 = nds32_read_argument (exp, 2);
284 int op0_num = return_p ? 1 : 0;
285 int op1_num = return_p ? 2 : 1;
286 int op2_num = return_p ? 3 : 2;
288 if (return_p)
289 target = nds32_legitimize_target (icode, target);
291 op0 = nds32_legitimize_argument (icode, op0_num, op0);
292 op1 = nds32_legitimize_argument (icode, op1_num, op1);
293 op2 = nds32_legitimize_argument (icode, op2_num, op2);
295 /* Emit and return the new instruction. */
296 if (return_p)
297 pat = GEN_FCN (icode) (target, op0, op1, op2);
298 else
299 pat = GEN_FCN (icode) (op0, op1, op2);
301 if (! pat)
302 return NULL_RTX;
304 emit_insn (pat);
305 return target;
308 /* Expand builtins that take three operands and the third is immediate. */
309 static rtx
310 nds32_expand_triopimm_builtin (enum insn_code icode, tree exp, rtx target,
311 bool return_p, const char *name)
313 rtx pat;
314 rtx op0 = nds32_read_argument (exp, 0);
315 rtx op1 = nds32_read_argument (exp, 1);
316 rtx op2 = nds32_read_argument (exp, 2);
317 int op0_num = return_p ? 1 : 0;
318 int op1_num = return_p ? 2 : 1;
319 int op2_num = return_p ? 3 : 2;
321 if (return_p)
322 target = nds32_legitimize_target (icode, target);
324 if (!nds32_check_constant_argument (icode, op2_num, op2, name))
325 return NULL_RTX;
327 op0 = nds32_legitimize_argument (icode, op0_num, op0);
328 op1 = nds32_legitimize_argument (icode, op1_num, op1);
329 op2 = nds32_legitimize_argument (icode, op2_num, op2);
331 /* Emit and return the new instruction. */
332 if (return_p)
333 pat = GEN_FCN (icode) (target, op0, op1, op2);
334 else
335 pat = GEN_FCN (icode) (op0, op1, op2);
337 if (! pat)
338 return NULL_RTX;
340 emit_insn (pat);
341 return target;
344 /* Expand builtins for load. */
345 static rtx
346 nds32_expand_builtin_load (enum insn_code icode, tree exp, rtx target)
348 /* Load address format is [$ra + $rb],
349 but input arguments not enough,
350 so we need another temp register as $rb.
351 Generating assembly code:
352 movi $temp, 0
353 llw $rt, [$ra + $temp] */
354 rtx pat;
355 rtx op0 = nds32_read_argument (exp, 0);
356 rtx addr_helper = gen_reg_rtx (insn_data[icode].operand[1].mode);
358 target = nds32_legitimize_target (icode, target);
359 op0 = nds32_legitimize_argument (icode, 1, op0);
361 /* Emit and return the new instruction. */
362 pat = GEN_FCN (icode) (target, op0, addr_helper);
363 if (!pat)
364 return NULL_RTX;
366 emit_move_insn (addr_helper, GEN_INT (0));
367 emit_insn (pat);
368 return target;
371 /* Expand builtins for store. */
372 static rtx
373 nds32_expand_builtin_store (enum insn_code icode, tree exp, rtx target)
375 /* Store address format is [$ra + $rb],
376 but input arguments not enough,
377 so we need another temp register as $rb.
378 Generating assembly code:
379 movi $temp, 0
380 store $rt, [$ra + $temp] */
381 rtx pat;
382 rtx op0 = nds32_read_argument (exp, 0);
383 rtx op1 = nds32_read_argument (exp, 1);
384 rtx addr_helper = gen_reg_rtx (insn_data[icode].operand[1].mode);
386 op0 = nds32_legitimize_argument (icode, 0, op0);
387 op1 = nds32_legitimize_argument (icode, 2, op1);
389 /* Emit and return the new instruction. */
390 pat = GEN_FCN (icode) (op0, addr_helper, op1);
391 if (! pat)
392 return NULL_RTX;
394 emit_move_insn (addr_helper, GEN_INT (0));
395 emit_insn (pat);
396 return target;
399 /* Expand cctl builtins. */
400 static rtx
401 nds32_expand_cctl_builtin (enum insn_code icode, tree exp, rtx target,
402 bool return_p, const char *name)
404 rtx pat;
405 rtx op0 = nds32_read_argument (exp, 0);
406 rtx op1 = nds32_read_argument (exp, 1);
407 int op0_num = return_p ? 1 : 0;
408 int op1_num = return_p ? 2 : 1;
410 if (return_p)
411 target = nds32_legitimize_target (icode, target);
413 if (!nds32_check_constant_argument (icode, op0_num, op0, name))
414 return NULL_RTX;
416 op0 = nds32_legitimize_argument (icode, op0_num, op0);
417 op1 = nds32_legitimize_argument (icode, op1_num, op1);
419 /* Emit and return the new instruction. */
420 if (icode == CODE_FOR_cctl_idx_write)
422 /* cctl_idx_write is three argument,
423 so create operand2 for cctl_idx_write pattern. */
424 rtx op2 = nds32_read_argument (exp, 2);
425 op2 = nds32_legitimize_argument (icode, 2, op2);
426 pat = GEN_FCN (icode) (op0, op1, op2);
428 else if (return_p)
429 pat = GEN_FCN (icode) (target, op0, op1);
430 else
431 pat = GEN_FCN (icode) (op0, op1);
433 if (! pat)
434 return NULL_RTX;
436 emit_insn (pat);
437 return target;
440 /* Expand scw builtins. */
441 static rtx
442 nds32_expand_scw_builtin (enum insn_code icode, tree exp, rtx target)
444 /* SCW address format is [$ra + $rb], but input arguments not enough,
445 so we need another temp register as $rb.
446 Generating assembly code:
447 movi $temp, 0
448 scw $rt, [$ra + $temp] */
449 rtx pat;
450 rtx op0 = nds32_read_argument (exp, 0);
451 rtx op1 = nds32_read_argument (exp, 1);
452 rtx addr_helper = gen_reg_rtx (insn_data[icode].operand[1].mode);
454 target = nds32_legitimize_target (icode, target);
455 op0 = nds32_legitimize_argument (icode, 1, op0);
456 op1 = nds32_legitimize_argument (icode, 2, op1);
458 /* Emit and return the new instruction. */
459 pat = GEN_FCN (icode) (target, op0, addr_helper, target);
461 if (!pat)
462 return NULL_RTX;
464 emit_move_insn (addr_helper, GEN_INT (0));
465 emit_move_insn (target, op1);
466 emit_insn (pat);
467 return target;
470 /* Expand set int priority builtins. */
471 static rtx
472 nds32_expand_priority_builtin (enum insn_code icode, tree exp, rtx target,
473 const char *name)
475 rtx pat;
476 rtx op0 = nds32_read_argument (exp, 0);
477 rtx op1 = nds32_read_argument (exp, 1);
479 /* set_int_priority intrinsic function that two arguments are immediate,
480 so check whether auguments are immedite. */
482 if (!nds32_check_constant_argument (icode, 0, op0, name))
483 return NULL_RTX;
485 if (!nds32_check_constant_argument (icode, 1, op1, name))
486 return NULL_RTX;
488 op0 = nds32_legitimize_argument (icode, 0, op0);
489 op1 = nds32_legitimize_argument (icode, 1, op1);
491 /* Emit and return the new instruction. */
492 pat = GEN_FCN (icode) (op0, op1);
494 if (! pat)
495 return NULL_RTX;
497 emit_insn (pat);
498 return target;
501 struct builtin_description
503 const enum insn_code icode;
504 const char *name;
505 enum nds32_builtins code;
506 bool return_p;
509 #define NDS32_BUILTIN(code, string, builtin) \
510 { CODE_FOR_##code, "__nds32__" string, \
511 NDS32_BUILTIN_##builtin, true },
513 #define NDS32_NO_TARGET_BUILTIN(code, string, builtin) \
514 { CODE_FOR_##code, "__nds32__" string, \
515 NDS32_BUILTIN_##builtin, false },
517 /* Intrinsics that no argument, and that return value. */
518 static struct builtin_description bdesc_noarg[] =
520 NDS32_BUILTIN(unspec_fmfcfg, "fmfcfg", FMFCFG)
521 NDS32_BUILTIN(unspec_fmfcsr, "fmfcsr", FMFCSR)
522 NDS32_BUILTIN(unspec_volatile_rdov, "rdov", RDOV)
523 NDS32_BUILTIN(unspec_get_current_sp, "get_current_sp", GET_CURRENT_SP)
524 NDS32_BUILTIN(unspec_return_address, "return_address", RETURN_ADDRESS)
525 NDS32_BUILTIN(unspec_get_all_pending_int, "get_all_pending_int",
526 GET_ALL_PENDING_INT)
527 NDS32_BUILTIN(unspec_unaligned_feature, "unaligned_feature",
528 UNALIGNED_FEATURE)
529 NDS32_NO_TARGET_BUILTIN(unspec_enable_unaligned, "enable_unaligned",
530 ENABLE_UNALIGNED)
531 NDS32_NO_TARGET_BUILTIN(unspec_disable_unaligned, "disable_unaligned",
532 DISABLE_UNALIGNED)
535 /* Intrinsics that take just one argument. */
536 static struct builtin_description bdesc_1arg[] =
538 NDS32_BUILTIN(unspec_ssabssi2, "abs", ABS)
539 NDS32_BUILTIN(clzsi2, "clz", CLZ)
540 NDS32_BUILTIN(unspec_clo, "clo", CLO)
541 NDS32_BUILTIN(unspec_wsbh, "wsbh", WSBH)
542 NDS32_BUILTIN(unspec_tlbop_pb, "tlbop_pb",TLBOP_PB)
543 NDS32_BUILTIN(unaligned_load_hw, "unaligned_load_hw", UALOAD_HW)
544 NDS32_BUILTIN(unaligned_loadsi, "unaligned_load_w", UALOAD_W)
545 NDS32_BUILTIN(unaligned_loaddi, "unaligned_load_dw", UALOAD_DW)
546 NDS32_NO_TARGET_BUILTIN(unspec_volatile_isync, "isync", ISYNC)
547 NDS32_NO_TARGET_BUILTIN(unspec_fmtcsr, "fmtcsr", FMTCSR)
548 NDS32_NO_TARGET_BUILTIN(unspec_jr_itoff, "jr_itoff", JR_ITOFF)
549 NDS32_NO_TARGET_BUILTIN(unspec_jr_toff, "jr_toff", JR_TOFF)
550 NDS32_NO_TARGET_BUILTIN(unspec_jral_ton, "jral_ton", JRAL_TON)
551 NDS32_NO_TARGET_BUILTIN(unspec_ret_toff, "ret_toff", RET_TOFF)
552 NDS32_NO_TARGET_BUILTIN(unspec_jral_iton, "jral_iton",JRAL_ITON)
553 NDS32_NO_TARGET_BUILTIN(unspec_tlbop_trd, "tlbop_trd", TLBOP_TRD)
554 NDS32_NO_TARGET_BUILTIN(unspec_tlbop_twr, "tlbop_twr", TLBOP_TWR)
555 NDS32_NO_TARGET_BUILTIN(unspec_tlbop_rwr, "tlbop_rwr", TLBOP_RWR)
556 NDS32_NO_TARGET_BUILTIN(unspec_tlbop_rwlk, "tlbop_rwlk", TLBOP_RWLK)
557 NDS32_NO_TARGET_BUILTIN(unspec_tlbop_unlk, "tlbop_unlk", TLBOP_UNLK)
558 NDS32_NO_TARGET_BUILTIN(unspec_tlbop_inv, "tlbop_inv", TLBOP_INV)
559 NDS32_NO_TARGET_BUILTIN(unspec_ret_itoff, "ret_itoff", RET_ITOFF)
560 NDS32_NO_TARGET_BUILTIN(unspec_set_current_sp,
561 "set_current_sp", SET_CURRENT_SP)
562 NDS32_BUILTIN(kabsv2hi2, "kabs16", KABS16)
563 NDS32_BUILTIN(kabsv2hi2, "v_kabs16", V_KABS16)
564 NDS32_BUILTIN(kabsv4qi2, "kabs8", KABS8)
565 NDS32_BUILTIN(kabsv4qi2, "v_kabs8", V_KABS8)
566 NDS32_BUILTIN(sunpkd810, "sunpkd810", SUNPKD810)
567 NDS32_BUILTIN(sunpkd810, "v_sunpkd810", V_SUNPKD810)
568 NDS32_BUILTIN(sunpkd820, "sunpkd820", SUNPKD820)
569 NDS32_BUILTIN(sunpkd820, "v_sunpkd820", V_SUNPKD820)
570 NDS32_BUILTIN(sunpkd830, "sunpkd830", SUNPKD830)
571 NDS32_BUILTIN(sunpkd830, "v_sunpkd830", V_SUNPKD830)
572 NDS32_BUILTIN(sunpkd831, "sunpkd831", SUNPKD831)
573 NDS32_BUILTIN(sunpkd831, "v_sunpkd831", V_SUNPKD831)
574 NDS32_BUILTIN(zunpkd810, "zunpkd810", ZUNPKD810)
575 NDS32_BUILTIN(zunpkd810, "v_zunpkd810", V_ZUNPKD810)
576 NDS32_BUILTIN(zunpkd820, "zunpkd820", ZUNPKD820)
577 NDS32_BUILTIN(zunpkd820, "v_zunpkd820", V_ZUNPKD820)
578 NDS32_BUILTIN(zunpkd830, "zunpkd830", ZUNPKD830)
579 NDS32_BUILTIN(zunpkd830, "v_zunpkd830", V_ZUNPKD830)
580 NDS32_BUILTIN(zunpkd831, "zunpkd831", ZUNPKD831)
581 NDS32_BUILTIN(zunpkd831, "v_zunpkd831", V_ZUNPKD831)
582 NDS32_BUILTIN(unspec_kabs, "kabs", KABS)
583 NDS32_BUILTIN(unaligned_loadv2hi, "get_unaligned_u16x2", UALOAD_U16)
584 NDS32_BUILTIN(unaligned_loadv2hi, "get_unaligned_s16x2", UALOAD_S16)
585 NDS32_BUILTIN(unaligned_loadv4qi, "get_unaligned_u8x4", UALOAD_U8)
586 NDS32_BUILTIN(unaligned_loadv4qi, "get_unaligned_s8x4", UALOAD_S8)
589 /* Intrinsics that take just one argument. and the argument is immediate. */
590 static struct builtin_description bdesc_1argimm[] =
592 NDS32_BUILTIN(unspec_volatile_mfsr, "mfsr", MFSR)
593 NDS32_BUILTIN(unspec_volatile_mfusr, "mfsr", MFUSR)
594 NDS32_BUILTIN(unspec_get_pending_int, "get_pending_int", GET_PENDING_INT)
595 NDS32_BUILTIN(unspec_get_int_priority, "get_int_priority", GET_INT_PRIORITY)
596 NDS32_NO_TARGET_BUILTIN(unspec_trap, "trap", TRAP)
597 NDS32_NO_TARGET_BUILTIN(unspec_break, "break", BREAK)
598 NDS32_NO_TARGET_BUILTIN(unspec_syscall, "syscall", SYSCALL)
599 NDS32_NO_TARGET_BUILTIN(unspec_enable_int, "enable_int", ENABLE_INT)
600 NDS32_NO_TARGET_BUILTIN(unspec_disable_int, "disable_int", DISABLE_INT)
601 NDS32_NO_TARGET_BUILTIN(unspec_clr_pending_hwint, "clr_pending_hwint",
602 CLR_PENDING_HWINT)
603 NDS32_NO_TARGET_BUILTIN(unspec_set_trig_level, "set_trig_level",
604 SET_TRIG_LEVEL)
605 NDS32_NO_TARGET_BUILTIN(unspec_set_trig_edge, "set_trig_edge",
606 SET_TRIG_EDGE)
607 NDS32_BUILTIN(unspec_get_trig_type, "get_trig_type", GET_TRIG_TYPE)
610 /* Intrinsics that take two arguments. */
611 static struct builtin_description bdesc_2arg[] =
613 NDS32_BUILTIN(unspec_fcpynss, "fcpynss", FCPYNSS)
614 NDS32_BUILTIN(unspec_fcpyss, "fcpyss", FCPYSS)
615 NDS32_BUILTIN(unspec_fcpynsd, "fcpynsd", FCPYNSD)
616 NDS32_BUILTIN(unspec_fcpysd, "fcpysd", FCPYSD)
617 NDS32_BUILTIN(unspec_ave, "ave", AVE)
618 NDS32_BUILTIN(unspec_pbsad, "pbsad", PBSAD)
619 NDS32_BUILTIN(unspec_ffb, "ffb", FFB)
620 NDS32_BUILTIN(unspec_ffmism, "ffmsim", FFMISM)
621 NDS32_BUILTIN(unspec_flmism, "flmism", FLMISM)
622 NDS32_BUILTIN(unspec_kaddw, "kaddw", KADDW)
623 NDS32_BUILTIN(unspec_kaddh, "kaddh", KADDH)
624 NDS32_BUILTIN(unspec_ksubw, "ksubw", KSUBW)
625 NDS32_BUILTIN(unspec_ksubh, "ksubh", KSUBH)
626 NDS32_BUILTIN(unspec_kdmbb, "kdmbb", KDMBB)
627 NDS32_BUILTIN(unspec_kdmbb, "v_kdmbb", V_KDMBB)
628 NDS32_BUILTIN(unspec_kdmbt, "kdmbt", KDMBT)
629 NDS32_BUILTIN(unspec_kdmbt, "v_kdmbt", V_KDMBT)
630 NDS32_BUILTIN(unspec_kdmtb, "kdmtb", KDMTB)
631 NDS32_BUILTIN(unspec_kdmtb, "v_kdmtb", V_KDMTB)
632 NDS32_BUILTIN(unspec_kdmtt, "kdmtt", KDMTT)
633 NDS32_BUILTIN(unspec_kdmtt, "v_kdmtt", V_KDMTT)
634 NDS32_BUILTIN(unspec_khmbb, "khmbb", KHMBB)
635 NDS32_BUILTIN(unspec_khmbb, "v_khmbb", V_KHMBB)
636 NDS32_BUILTIN(unspec_khmbt, "khmbt", KHMBT)
637 NDS32_BUILTIN(unspec_khmbt, "v_khmbt", V_KHMBT)
638 NDS32_BUILTIN(unspec_khmtb, "khmtb", KHMTB)
639 NDS32_BUILTIN(unspec_khmtb, "v_khmtb", V_KHMTB)
640 NDS32_BUILTIN(unspec_khmtt, "khmtt", KHMTT)
641 NDS32_BUILTIN(unspec_khmtt, "v_khmtt", V_KHMTT)
642 NDS32_BUILTIN(unspec_kslraw, "kslraw", KSLRAW)
643 NDS32_BUILTIN(unspec_kslrawu, "kslraw_u", KSLRAW_U)
644 NDS32_BUILTIN(rotrsi3, "rotr", ROTR)
645 NDS32_BUILTIN(unspec_sva, "sva", SVA)
646 NDS32_BUILTIN(unspec_svs, "svs", SVS)
647 NDS32_NO_TARGET_BUILTIN(mtsr_isb, "mtsr_isb", MTSR_ISB)
648 NDS32_NO_TARGET_BUILTIN(mtsr_dsb, "mtsr_dsb", MTSR_DSB)
649 NDS32_NO_TARGET_BUILTIN(unspec_volatile_mtsr, "mtsr", MTSR)
650 NDS32_NO_TARGET_BUILTIN(unspec_volatile_mtusr, "mtusr", MTUSR)
651 NDS32_NO_TARGET_BUILTIN(unaligned_store_hw, "unaligned_store_hw", UASTORE_HW)
652 NDS32_NO_TARGET_BUILTIN(unaligned_storesi, "unaligned_store_hw", UASTORE_W)
653 NDS32_NO_TARGET_BUILTIN(unaligned_storedi, "unaligned_store_hw", UASTORE_DW)
654 NDS32_BUILTIN(addv2hi3, "add16", ADD16)
655 NDS32_BUILTIN(addv2hi3, "v_uadd16", V_UADD16)
656 NDS32_BUILTIN(addv2hi3, "v_sadd16", V_SADD16)
657 NDS32_BUILTIN(raddv2hi3, "radd16", RADD16)
658 NDS32_BUILTIN(raddv2hi3, "v_radd16", V_RADD16)
659 NDS32_BUILTIN(uraddv2hi3, "uradd16", URADD16)
660 NDS32_BUILTIN(uraddv2hi3, "v_uradd16", V_URADD16)
661 NDS32_BUILTIN(kaddv2hi3, "kadd16", KADD16)
662 NDS32_BUILTIN(kaddv2hi3, "v_kadd16", V_KADD16)
663 NDS32_BUILTIN(ukaddv2hi3, "ukadd16", UKADD16)
664 NDS32_BUILTIN(ukaddv2hi3, "v_ukadd16", V_UKADD16)
665 NDS32_BUILTIN(subv2hi3, "sub16", SUB16)
666 NDS32_BUILTIN(subv2hi3, "v_usub16", V_USUB16)
667 NDS32_BUILTIN(subv2hi3, "v_ssub16", V_SSUB16)
668 NDS32_BUILTIN(rsubv2hi3, "rsub16", RSUB16)
669 NDS32_BUILTIN(rsubv2hi3, "v_rsub16", V_RSUB16)
670 NDS32_BUILTIN(ursubv2hi3, "ursub16", URSUB16)
671 NDS32_BUILTIN(ursubv2hi3, "v_ursub16", V_URSUB16)
672 NDS32_BUILTIN(ksubv2hi3, "ksub16", KSUB16)
673 NDS32_BUILTIN(ksubv2hi3, "v_ksub16", V_KSUB16)
674 NDS32_BUILTIN(uksubv2hi3, "uksub16", UKSUB16)
675 NDS32_BUILTIN(uksubv2hi3, "v_uksub16", V_UKSUB16)
676 NDS32_BUILTIN(cras16_1, "cras16", CRAS16)
677 NDS32_BUILTIN(cras16_1, "v_ucras16", V_UCRAS16)
678 NDS32_BUILTIN(cras16_1, "v_scras16", V_SCRAS16)
679 NDS32_BUILTIN(rcras16_1, "rcras16", RCRAS16)
680 NDS32_BUILTIN(rcras16_1, "v_rcras16", V_RCRAS16)
681 NDS32_BUILTIN(urcras16_1, "urcras16", URCRAS16)
682 NDS32_BUILTIN(urcras16_1, "v_urcras16", V_URCRAS16)
683 NDS32_BUILTIN(kcras16_1, "kcras16", KCRAS16)
684 NDS32_BUILTIN(kcras16_1, "v_kcras16", V_KCRAS16)
685 NDS32_BUILTIN(ukcras16_1, "ukcras16", UKCRAS16)
686 NDS32_BUILTIN(ukcras16_1, "v_ukcras16", V_UKCRAS16)
687 NDS32_BUILTIN(crsa16_1, "crsa16", CRSA16)
688 NDS32_BUILTIN(crsa16_1, "v_ucrsa16", V_UCRSA16)
689 NDS32_BUILTIN(crsa16_1, "v_scrsa16", V_SCRSA16)
690 NDS32_BUILTIN(rcrsa16_1, "rcrsa16", RCRSA16)
691 NDS32_BUILTIN(rcrsa16_1, "v_rcrsa16", V_RCRSA16)
692 NDS32_BUILTIN(urcrsa16_1, "urcrsa16", URCRSA16)
693 NDS32_BUILTIN(urcrsa16_1, "v_urcrsa16", V_URCRSA16)
694 NDS32_BUILTIN(kcrsa16_1, "kcrsa16", KCRSA16)
695 NDS32_BUILTIN(kcrsa16_1, "v_kcrsa16", V_KCRSA16)
696 NDS32_BUILTIN(ukcrsa16_1, "ukcrsa16", UKCRSA16)
697 NDS32_BUILTIN(ukcrsa16_1, "v_ukcrsa16", V_UKCRSA16)
698 NDS32_BUILTIN(addv4qi3, "add8", ADD8)
699 NDS32_BUILTIN(addv4qi3, "v_uadd8", V_UADD8)
700 NDS32_BUILTIN(addv4qi3, "v_sadd8", V_SADD8)
701 NDS32_BUILTIN(raddv4qi3, "radd8", RADD8)
702 NDS32_BUILTIN(raddv4qi3, "v_radd8", V_RADD8)
703 NDS32_BUILTIN(uraddv4qi3, "uradd8", URADD8)
704 NDS32_BUILTIN(uraddv4qi3, "v_uradd8", V_URADD8)
705 NDS32_BUILTIN(kaddv4qi3, "kadd8", KADD8)
706 NDS32_BUILTIN(kaddv4qi3, "v_kadd8", V_KADD8)
707 NDS32_BUILTIN(ukaddv4qi3, "ukadd8", UKADD8)
708 NDS32_BUILTIN(ukaddv4qi3, "v_ukadd8", V_UKADD8)
709 NDS32_BUILTIN(subv4qi3, "sub8", SUB8)
710 NDS32_BUILTIN(subv4qi3, "v_usub8", V_USUB8)
711 NDS32_BUILTIN(subv4qi3, "v_ssub8", V_SSUB8)
712 NDS32_BUILTIN(rsubv4qi3, "rsub8", RSUB8)
713 NDS32_BUILTIN(rsubv4qi3, "v_rsub8", V_RSUB8)
714 NDS32_BUILTIN(ursubv4qi3, "ursub8", URSUB8)
715 NDS32_BUILTIN(ursubv4qi3, "v_ursub8", V_URSUB8)
716 NDS32_BUILTIN(ksubv4qi3, "ksub8", KSUB8)
717 NDS32_BUILTIN(ksubv4qi3, "v_ksub8", V_KSUB8)
718 NDS32_BUILTIN(uksubv4qi3, "uksub8", UKSUB8)
719 NDS32_BUILTIN(uksubv4qi3, "v_uksub8", V_UKSUB8)
720 NDS32_BUILTIN(ashrv2hi3, "sra16", SRA16)
721 NDS32_BUILTIN(ashrv2hi3, "v_sra16", V_SRA16)
722 NDS32_BUILTIN(sra16_round, "sra16_u", SRA16_U)
723 NDS32_BUILTIN(sra16_round, "v_sra16_u", V_SRA16_U)
724 NDS32_BUILTIN(lshrv2hi3, "srl16", SRL16)
725 NDS32_BUILTIN(lshrv2hi3, "v_srl16", V_SRL16)
726 NDS32_BUILTIN(srl16_round, "srl16_u", SRL16_U)
727 NDS32_BUILTIN(srl16_round, "v_srl16_u", V_SRL16_U)
728 NDS32_BUILTIN(ashlv2hi3, "sll16", SLL16)
729 NDS32_BUILTIN(ashlv2hi3, "v_sll16", V_SLL16)
730 NDS32_BUILTIN(kslli16, "ksll16", KSLL16)
731 NDS32_BUILTIN(kslli16, "v_ksll16", V_KSLL16)
732 NDS32_BUILTIN(kslra16, "kslra16", KSLRA16)
733 NDS32_BUILTIN(kslra16, "v_kslra16", V_KSLRA16)
734 NDS32_BUILTIN(kslra16_round, "kslra16_u", KSLRA16_U)
735 NDS32_BUILTIN(kslra16_round, "v_kslra16_u", V_KSLRA16_U)
736 NDS32_BUILTIN(cmpeq16, "cmpeq16", CMPEQ16)
737 NDS32_BUILTIN(cmpeq16, "v_scmpeq16", V_SCMPEQ16)
738 NDS32_BUILTIN(cmpeq16, "v_ucmpeq16", V_UCMPEQ16)
739 NDS32_BUILTIN(scmplt16, "scmplt16", SCMPLT16)
740 NDS32_BUILTIN(scmplt16, "v_scmplt16", V_SCMPLT16)
741 NDS32_BUILTIN(scmple16, "scmple16", SCMPLE16)
742 NDS32_BUILTIN(scmple16, "v_scmple16", V_SCMPLE16)
743 NDS32_BUILTIN(ucmplt16, "ucmplt16", UCMPLT16)
744 NDS32_BUILTIN(ucmplt16, "v_ucmplt16", V_UCMPLT16)
745 NDS32_BUILTIN(ucmplt16, "ucmple16", UCMPLE16)
746 NDS32_BUILTIN(ucmplt16, "v_ucmple16", V_UCMPLE16)
747 NDS32_BUILTIN(cmpeq8, "cmpeq8", CMPEQ8)
748 NDS32_BUILTIN(cmpeq8, "v_scmpeq8", V_SCMPEQ8)
749 NDS32_BUILTIN(cmpeq8, "v_ucmpeq8", V_UCMPEQ8)
750 NDS32_BUILTIN(scmplt8, "scmplt8", SCMPLT8)
751 NDS32_BUILTIN(scmplt8, "v_scmplt8", V_SCMPLT8)
752 NDS32_BUILTIN(scmple8, "scmple8", SCMPLE8)
753 NDS32_BUILTIN(scmple8, "v_scmple8", V_SCMPLE8)
754 NDS32_BUILTIN(ucmplt8, "ucmplt8", UCMPLT8)
755 NDS32_BUILTIN(ucmplt8, "v_ucmplt8", V_UCMPLT8)
756 NDS32_BUILTIN(ucmplt8, "ucmple8", UCMPLE8)
757 NDS32_BUILTIN(ucmplt8, "v_ucmple8", V_UCMPLE8)
758 NDS32_BUILTIN(sminv2hi3, "smin16", SMIN16)
759 NDS32_BUILTIN(sminv2hi3, "v_smin16", V_SMIN16)
760 NDS32_BUILTIN(uminv2hi3, "umin16", UMIN16)
761 NDS32_BUILTIN(uminv2hi3, "v_umin16", V_UMIN16)
762 NDS32_BUILTIN(smaxv2hi3, "smax16", SMAX16)
763 NDS32_BUILTIN(smaxv2hi3, "v_smax16", V_SMAX16)
764 NDS32_BUILTIN(umaxv2hi3, "umax16", UMAX16)
765 NDS32_BUILTIN(umaxv2hi3, "v_umax16", V_UMAX16)
766 NDS32_BUILTIN(khm16, "khm16", KHM16)
767 NDS32_BUILTIN(khm16, "v_khm16", V_KHM16)
768 NDS32_BUILTIN(khmx16, "khmx16", KHMX16)
769 NDS32_BUILTIN(khmx16, "v_khmx16", V_KHMX16)
770 NDS32_BUILTIN(sminv4qi3, "smin8", SMIN8)
771 NDS32_BUILTIN(sminv4qi3, "v_smin8", V_SMIN8)
772 NDS32_BUILTIN(uminv4qi3, "umin8", UMIN8)
773 NDS32_BUILTIN(uminv4qi3, "v_umin8", V_UMIN8)
774 NDS32_BUILTIN(smaxv4qi3, "smax8", SMAX8)
775 NDS32_BUILTIN(smaxv4qi3, "v_smax8", V_SMAX8)
776 NDS32_BUILTIN(umaxv4qi3, "umax8", UMAX8)
777 NDS32_BUILTIN(umaxv4qi3, "v_umax8", V_UMAX8)
778 NDS32_BUILTIN(raddsi3, "raddw", RADDW)
779 NDS32_BUILTIN(uraddsi3, "uraddw", URADDW)
780 NDS32_BUILTIN(rsubsi3, "rsubw", RSUBW)
781 NDS32_BUILTIN(ursubsi3, "ursubw", URSUBW)
782 NDS32_BUILTIN(sraiu, "sra_u", SRA_U)
783 NDS32_BUILTIN(kssl, "ksll", KSLL)
784 NDS32_BUILTIN(pkbb, "pkbb16", PKBB16)
785 NDS32_BUILTIN(pkbb, "v_pkbb16", V_PKBB16)
786 NDS32_BUILTIN(pkbt, "pkbt16", PKBT16)
787 NDS32_BUILTIN(pkbt, "v_pkbt16", V_PKBT16)
788 NDS32_BUILTIN(pktb, "pktb16", PKTB16)
789 NDS32_BUILTIN(pktb, "v_pktb16", V_PKTB16)
790 NDS32_BUILTIN(pktt, "pktt16", PKTT16)
791 NDS32_BUILTIN(pktt, "v_pktt16", V_PKTT16)
792 NDS32_BUILTIN(smulsi3_highpart, "smmul", SMMUL)
793 NDS32_BUILTIN(smmul_round, "smmul_u", SMMUL_U)
794 NDS32_BUILTIN(smmwb, "smmwb", SMMWB)
795 NDS32_BUILTIN(smmwb, "v_smmwb", V_SMMWB)
796 NDS32_BUILTIN(smmwb_round, "smmwb_u", SMMWB_U)
797 NDS32_BUILTIN(smmwb_round, "v_smmwb_u", V_SMMWB_U)
798 NDS32_BUILTIN(smmwt, "smmwt", SMMWT)
799 NDS32_BUILTIN(smmwt, "v_smmwt", V_SMMWT)
800 NDS32_BUILTIN(smmwt_round, "smmwt_u", SMMWT_U)
801 NDS32_BUILTIN(smmwt_round, "v_smmwt_u", V_SMMWT_U)
802 NDS32_BUILTIN(smbb, "smbb", SMBB)
803 NDS32_BUILTIN(smbb, "v_smbb", V_SMBB)
804 NDS32_BUILTIN(smbt, "smbt", SMBT)
805 NDS32_BUILTIN(smbt, "v_smbt", V_SMBT)
806 NDS32_BUILTIN(smtt, "smtt", SMTT)
807 NDS32_BUILTIN(smtt, "v_smtt", V_SMTT)
808 NDS32_BUILTIN(kmda, "kmda", KMDA)
809 NDS32_BUILTIN(kmda, "v_kmda", V_KMDA)
810 NDS32_BUILTIN(kmxda, "kmxda", KMXDA)
811 NDS32_BUILTIN(kmxda, "v_kmxda", V_KMXDA)
812 NDS32_BUILTIN(smds, "smds", SMDS)
813 NDS32_BUILTIN(smds, "v_smds", V_SMDS)
814 NDS32_BUILTIN(smdrs, "smdrs", SMDRS)
815 NDS32_BUILTIN(smdrs, "v_smdrs", V_SMDRS)
816 NDS32_BUILTIN(smxdsv, "smxds", SMXDS)
817 NDS32_BUILTIN(smxdsv, "v_smxds", V_SMXDS)
818 NDS32_BUILTIN(smal1, "smal", SMAL)
819 NDS32_BUILTIN(smal1, "v_smal", V_SMAL)
820 NDS32_BUILTIN(bitrev, "bitrev", BITREV)
821 NDS32_BUILTIN(wext, "wext", WEXT)
822 NDS32_BUILTIN(adddi3, "sadd64", SADD64)
823 NDS32_BUILTIN(adddi3, "uadd64", UADD64)
824 NDS32_BUILTIN(radddi3, "radd64", RADD64)
825 NDS32_BUILTIN(uradddi3, "uradd64", URADD64)
826 NDS32_BUILTIN(kadddi3, "kadd64", KADD64)
827 NDS32_BUILTIN(ukadddi3, "ukadd64", UKADD64)
828 NDS32_BUILTIN(subdi3, "ssub64", SSUB64)
829 NDS32_BUILTIN(subdi3, "usub64", USUB64)
830 NDS32_BUILTIN(rsubdi3, "rsub64", RSUB64)
831 NDS32_BUILTIN(ursubdi3, "ursub64", URSUB64)
832 NDS32_BUILTIN(ksubdi3, "ksub64", KSUB64)
833 NDS32_BUILTIN(uksubdi3, "uksub64", UKSUB64)
834 NDS32_BUILTIN(smul16, "smul16", SMUL16)
835 NDS32_BUILTIN(smul16, "v_smul16", V_SMUL16)
836 NDS32_BUILTIN(smulx16, "smulx16", SMULX16)
837 NDS32_BUILTIN(smulx16, "v_smulx16", V_SMULX16)
838 NDS32_BUILTIN(umul16, "umul16", UMUL16)
839 NDS32_BUILTIN(umul16, "v_umul16", V_UMUL16)
840 NDS32_BUILTIN(umulx16, "umulx16", UMULX16)
841 NDS32_BUILTIN(umulx16, "v_umulx16", V_UMULX16)
842 NDS32_BUILTIN(kwmmul, "kwmmul", KWMMUL)
843 NDS32_BUILTIN(kwmmul_round, "kwmmul_u", KWMMUL_U)
844 NDS32_NO_TARGET_BUILTIN(unaligned_storev2hi,
845 "put_unaligned_u16x2", UASTORE_U16)
846 NDS32_NO_TARGET_BUILTIN(unaligned_storev2hi,
847 "put_unaligned_s16x2", UASTORE_S16)
848 NDS32_NO_TARGET_BUILTIN(unaligned_storev4qi, "put_unaligned_u8x4", UASTORE_U8)
849 NDS32_NO_TARGET_BUILTIN(unaligned_storev4qi, "put_unaligned_s8x4", UASTORE_S8)
852 /* Two-argument intrinsics with an immediate second argument. */
853 static struct builtin_description bdesc_2argimm[] =
855 NDS32_BUILTIN(unspec_bclr, "bclr", BCLR)
856 NDS32_BUILTIN(unspec_bset, "bset", BSET)
857 NDS32_BUILTIN(unspec_btgl, "btgl", BTGL)
858 NDS32_BUILTIN(unspec_btst, "btst", BTST)
859 NDS32_BUILTIN(unspec_clip, "clip", CLIP)
860 NDS32_BUILTIN(unspec_clips, "clips", CLIPS)
861 NDS32_NO_TARGET_BUILTIN(unspec_teqz, "teqz", TEQZ)
862 NDS32_NO_TARGET_BUILTIN(unspec_tnez, "tnez", TNEZ)
863 NDS32_BUILTIN(ashrv2hi3, "srl16", SRL16)
864 NDS32_BUILTIN(ashrv2hi3, "v_srl16", V_SRL16)
865 NDS32_BUILTIN(srl16_round, "srl16_u", SRL16_U)
866 NDS32_BUILTIN(srl16_round, "v_srl16_u", V_SRL16_U)
867 NDS32_BUILTIN(kslli16, "ksll16", KSLL16)
868 NDS32_BUILTIN(kslli16, "v_ksll16", V_KSLL16)
869 NDS32_BUILTIN(sclip16, "sclip16", SCLIP16)
870 NDS32_BUILTIN(sclip16, "v_sclip16", V_SCLIP16)
871 NDS32_BUILTIN(uclip16, "uclip16", UCLIP16)
872 NDS32_BUILTIN(uclip16, "v_uclip16", V_UCLIP16)
873 NDS32_BUILTIN(sraiu, "sra_u", SRA_U)
874 NDS32_BUILTIN(kssl, "ksll", KSLL)
875 NDS32_BUILTIN(bitrev, "bitrev", BITREV)
876 NDS32_BUILTIN(wext, "wext", WEXT)
877 NDS32_BUILTIN(uclip32, "uclip32", UCLIP32)
878 NDS32_BUILTIN(sclip32, "sclip32", SCLIP32)
881 /* Intrinsics that take three arguments. */
882 static struct builtin_description bdesc_3arg[] =
884 NDS32_BUILTIN(unspec_pbsada, "pbsada", PBSADA)
885 NDS32_NO_TARGET_BUILTIN(bse, "bse", BSE)
886 NDS32_NO_TARGET_BUILTIN(bsp, "bsp", BSP)
887 NDS32_BUILTIN(kmabb, "kmabb", KMABB)
888 NDS32_BUILTIN(kmabb, "v_kmabb", V_KMABB)
889 NDS32_BUILTIN(kmabt, "kmabt", KMABT)
890 NDS32_BUILTIN(kmabt, "v_kmabt", V_KMABT)
891 NDS32_BUILTIN(kmatt, "kmatt", KMATT)
892 NDS32_BUILTIN(kmatt, "v_kmatt", V_KMATT)
893 NDS32_BUILTIN(kmada, "kmada", KMADA)
894 NDS32_BUILTIN(kmada, "v_kmada", V_KMADA)
895 NDS32_BUILTIN(kmaxda, "kmaxda", KMAXDA)
896 NDS32_BUILTIN(kmaxda, "v_kmaxda", V_KMAXDA)
897 NDS32_BUILTIN(kmads, "kmads", KMADS)
898 NDS32_BUILTIN(kmads, "v_kmads", V_KMADS)
899 NDS32_BUILTIN(kmadrs, "kmadrs", KMADRS)
900 NDS32_BUILTIN(kmadrs, "v_kmadrs", V_KMADRS)
901 NDS32_BUILTIN(kmaxds, "kmaxds", KMAXDS)
902 NDS32_BUILTIN(kmaxds, "v_kmaxds", V_KMAXDS)
903 NDS32_BUILTIN(kmsda, "kmsda", KMSDA)
904 NDS32_BUILTIN(kmsda, "v_kmsda", V_KMSDA)
905 NDS32_BUILTIN(kmsxda, "kmsxda", KMSXDA)
906 NDS32_BUILTIN(kmsxda, "v_kmsxda", V_KMSXDA)
907 NDS32_BUILTIN(bpick1, "bpick", BPICK)
908 NDS32_BUILTIN(smar64_1, "smar64", SMAR64)
909 NDS32_BUILTIN(smsr64, "smsr64", SMSR64)
910 NDS32_BUILTIN(umar64_1, "umar64", UMAR64)
911 NDS32_BUILTIN(umsr64, "umsr64", UMSR64)
912 NDS32_BUILTIN(kmar64_1, "kmar64", KMAR64)
913 NDS32_BUILTIN(kmsr64, "kmsr64", KMSR64)
914 NDS32_BUILTIN(ukmar64_1, "ukmar64", UKMAR64)
915 NDS32_BUILTIN(ukmsr64, "ukmsr64", UKMSR64)
916 NDS32_BUILTIN(smalbb, "smalbb", SMALBB)
917 NDS32_BUILTIN(smalbb, "v_smalbb", V_SMALBB)
918 NDS32_BUILTIN(smalbt, "smalbt", SMALBT)
919 NDS32_BUILTIN(smalbt, "v_smalbt", V_SMALBT)
920 NDS32_BUILTIN(smaltt, "smaltt", SMALTT)
921 NDS32_BUILTIN(smaltt, "v_smaltt", V_SMALTT)
922 NDS32_BUILTIN(smalda1, "smalda", SMALDA)
923 NDS32_BUILTIN(smalda1, "v_smalda", V_SMALDA)
924 NDS32_BUILTIN(smalxda1, "smalxda", SMALXDA)
925 NDS32_BUILTIN(smalxda1, "v_smalxda", V_SMALXDA)
926 NDS32_BUILTIN(smalds1, "smalds", SMALDS)
927 NDS32_BUILTIN(smalds1, "v_smalds", V_SMALDS)
928 NDS32_BUILTIN(smaldrs3, "smaldrs", SMALDRS)
929 NDS32_BUILTIN(smaldrs3, "v_smaldrs", V_SMALDRS)
930 NDS32_BUILTIN(smalxds1, "smalxds", SMALXDS)
931 NDS32_BUILTIN(smalxds1, "v_smalxds", V_SMALXDS)
932 NDS32_BUILTIN(smslda1, "smslda", SMSLDA)
933 NDS32_BUILTIN(smslda1, "v_smslda", V_SMSLDA)
934 NDS32_BUILTIN(smslxda1, "smslxda", SMSLXDA)
935 NDS32_BUILTIN(smslxda1, "v_smslxda", V_SMSLXDA)
936 NDS32_BUILTIN(kmmawb, "kmmawb", KMMAWB)
937 NDS32_BUILTIN(kmmawb, "v_kmmawb", V_KMMAWB)
938 NDS32_BUILTIN(kmmawb_round, "kmmawb_u", KMMAWB_U)
939 NDS32_BUILTIN(kmmawb_round, "v_kmmawb_u", V_KMMAWB_U)
940 NDS32_BUILTIN(kmmawt, "kmmawt", KMMAWT)
941 NDS32_BUILTIN(kmmawt, "v_kmmawt", V_KMMAWT)
942 NDS32_BUILTIN(kmmawt_round, "kmmawt_u", KMMAWT_U)
943 NDS32_BUILTIN(kmmawt_round, "v_kmmawt_u", V_KMMAWT_U)
944 NDS32_BUILTIN(kmmac, "kmmac", KMMAC)
945 NDS32_BUILTIN(kmmac_round, "kmmac_u", KMMAC_U)
946 NDS32_BUILTIN(kmmsb, "kmmsb", KMMSB)
947 NDS32_BUILTIN(kmmsb_round, "kmmsb_u", KMMSB_U)
950 /* Three-argument intrinsics with an immediate third argument. */
951 static struct builtin_description bdesc_3argimm[] =
953 NDS32_NO_TARGET_BUILTIN(prefetch_qw, "prefetch_qw", DPREF_QW)
954 NDS32_NO_TARGET_BUILTIN(prefetch_hw, "prefetch_hw", DPREF_HW)
955 NDS32_NO_TARGET_BUILTIN(prefetch_w, "prefetch_w", DPREF_W)
956 NDS32_NO_TARGET_BUILTIN(prefetch_dw, "prefetch_dw", DPREF_DW)
957 NDS32_BUILTIN(insb, "insb", INSB)
960 /* Intrinsics that load a value. */
961 static struct builtin_description bdesc_load[] =
963 NDS32_BUILTIN(unspec_volatile_llw, "llw", LLW)
964 NDS32_BUILTIN(unspec_lwup, "lwup", LWUP)
965 NDS32_BUILTIN(unspec_lbup, "lbup", LBUP)
968 /* Intrinsics that store a value. */
969 static struct builtin_description bdesc_store[] =
971 NDS32_BUILTIN(unspec_swup, "swup", SWUP)
972 NDS32_BUILTIN(unspec_sbup, "sbup", SBUP)
975 static struct builtin_description bdesc_cctl[] =
977 NDS32_BUILTIN(cctl_idx_read, "cctl_idx_read", CCTL_IDX_READ)
978 NDS32_NO_TARGET_BUILTIN(cctl_idx_write, "cctl_idx_write", CCTL_IDX_WRITE)
979 NDS32_NO_TARGET_BUILTIN(cctl_va_lck, "cctl_va_lck", CCTL_VA_LCK)
980 NDS32_NO_TARGET_BUILTIN(cctl_idx_wbinval,
981 "cctl_idx_wbinval", CCTL_IDX_WBINVAL)
982 NDS32_NO_TARGET_BUILTIN(cctl_va_wbinval_l1,
983 "cctl_va_wbinval_l1", CCTL_VA_WBINVAL_L1)
984 NDS32_NO_TARGET_BUILTIN(cctl_va_wbinval_la,
985 "cctl_va_wbinval_la", CCTL_VA_WBINVAL_LA)
989 nds32_expand_builtin_impl (tree exp,
990 rtx target,
991 rtx subtarget ATTRIBUTE_UNUSED,
992 enum machine_mode mode ATTRIBUTE_UNUSED,
993 int ignore ATTRIBUTE_UNUSED)
995 tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
996 unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
997 unsigned i;
998 struct builtin_description *d;
1000 if (!NDS32_EXT_DSP_P ()
1001 && fcode > NDS32_BUILTIN_DSP_BEGIN
1002 && fcode < NDS32_BUILTIN_DSP_END)
1003 error ("don't support DSP extension instructions");
1005 switch (fcode)
1007 /* FPU Register Transfer. */
1008 case NDS32_BUILTIN_FMFCFG:
1009 case NDS32_BUILTIN_FMFCSR:
1010 case NDS32_BUILTIN_FMTCSR:
1011 case NDS32_BUILTIN_FCPYNSS:
1012 case NDS32_BUILTIN_FCPYSS:
1013 /* Both v3s and v3f toolchains define TARGET_FPU_SINGLE. */
1014 if (!TARGET_FPU_SINGLE)
1016 error ("this builtin function is only available "
1017 "on the v3s or v3f toolchain");
1018 return NULL_RTX;
1020 break;
1022 /* FPU Register Transfer. */
1023 case NDS32_BUILTIN_FCPYNSD:
1024 case NDS32_BUILTIN_FCPYSD:
1025 /* Only v3f toolchain defines TARGET_FPU_DOUBLE. */
1026 if (!TARGET_FPU_DOUBLE)
1028 error ("this builtin function is only available "
1029 "on the v3f toolchain");
1030 return NULL_RTX;
1032 break;
1034 /* Load and Store */
1035 case NDS32_BUILTIN_LLW:
1036 case NDS32_BUILTIN_LWUP:
1037 case NDS32_BUILTIN_LBUP:
1038 case NDS32_BUILTIN_SCW:
1039 case NDS32_BUILTIN_SWUP:
1040 case NDS32_BUILTIN_SBUP:
1041 if (TARGET_ISA_V3M)
1043 error ("this builtin function not support "
1044 "on the v3m toolchain");
1045 return NULL_RTX;
1047 break;
1049 /* Performance Extension */
1050 case NDS32_BUILTIN_ABS:
1051 case NDS32_BUILTIN_AVE:
1052 case NDS32_BUILTIN_BCLR:
1053 case NDS32_BUILTIN_BSET:
1054 case NDS32_BUILTIN_BTGL:
1055 case NDS32_BUILTIN_BTST:
1056 case NDS32_BUILTIN_CLIP:
1057 case NDS32_BUILTIN_CLIPS:
1058 case NDS32_BUILTIN_CLZ:
1059 case NDS32_BUILTIN_CLO:
1060 if (!TARGET_EXT_PERF)
1062 error ("don't support performance extension instructions");
1063 return NULL_RTX;
1065 break;
1067 /* Performance Extension 2 */
1068 case NDS32_BUILTIN_PBSAD:
1069 case NDS32_BUILTIN_PBSADA:
1070 case NDS32_BUILTIN_BSE:
1071 case NDS32_BUILTIN_BSP:
1072 if (!TARGET_EXT_PERF2)
1074 error ("don't support performance extension "
1075 "version 2 instructions");
1076 return NULL_RTX;
1078 break;
1080 /* String Extension */
1081 case NDS32_BUILTIN_FFB:
1082 case NDS32_BUILTIN_FFMISM:
1083 case NDS32_BUILTIN_FLMISM:
1084 if (!TARGET_EXT_STRING)
1086 error ("don't support string extension instructions");
1087 return NULL_RTX;
1089 break;
1091 default:
1092 break;
1095 /* Since there are no result and operands, we can simply emit this rtx. */
1096 switch (fcode)
1098 case NDS32_BUILTIN_ISB:
1099 emit_insn (gen_unspec_volatile_isb ());
1100 return target;
1101 case NDS32_BUILTIN_DSB:
1102 emit_insn (gen_unspec_dsb ());
1103 return target;
1104 case NDS32_BUILTIN_MSYNC_ALL:
1105 emit_insn (gen_unspec_msync_all ());
1106 return target;
1107 case NDS32_BUILTIN_MSYNC_STORE:
1108 emit_insn (gen_unspec_msync_store ());
1109 return target;
1110 case NDS32_BUILTIN_SETGIE_EN:
1111 emit_insn (gen_unspec_volatile_setgie_en ());
1112 emit_insn (gen_unspec_dsb ());
1113 return target;
1114 case NDS32_BUILTIN_SETGIE_DIS:
1115 emit_insn (gen_unspec_volatile_setgie_dis ());
1116 emit_insn (gen_unspec_dsb ());
1117 return target;
1118 case NDS32_BUILTIN_GIE_DIS:
1119 emit_insn (gen_unspec_volatile_setgie_dis ());
1120 emit_insn (gen_unspec_dsb ());
1121 return target;
1122 case NDS32_BUILTIN_GIE_EN:
1123 emit_insn (gen_unspec_volatile_setgie_en ());
1124 emit_insn (gen_unspec_dsb ());
1125 return target;
1126 case NDS32_BUILTIN_SET_PENDING_SWINT:
1127 emit_insn (gen_unspec_set_pending_swint ());
1128 return target;
1129 case NDS32_BUILTIN_CLR_PENDING_SWINT:
1130 emit_insn (gen_unspec_clr_pending_swint ());
1131 return target;
1132 case NDS32_BUILTIN_CCTL_L1D_INVALALL:
1133 emit_insn (gen_cctl_l1d_invalall());
1134 return target;
1135 case NDS32_BUILTIN_CCTL_L1D_WBALL_ALVL:
1136 emit_insn (gen_cctl_l1d_wball_alvl());
1137 return target;
1138 case NDS32_BUILTIN_CCTL_L1D_WBALL_ONE_LVL:
1139 emit_insn (gen_cctl_l1d_wball_one_lvl());
1140 return target;
1141 case NDS32_BUILTIN_CLROV:
1142 emit_insn (gen_unspec_volatile_clrov ());
1143 return target;
1144 case NDS32_BUILTIN_STANDBY_NO_WAKE_GRANT:
1145 emit_insn (gen_unspec_standby_no_wake_grant ());
1146 return target;
1147 case NDS32_BUILTIN_STANDBY_WAKE_GRANT:
1148 emit_insn (gen_unspec_standby_wake_grant ());
1149 return target;
1150 case NDS32_BUILTIN_STANDBY_WAKE_DONE:
1151 emit_insn (gen_unspec_standby_wait_done ());
1152 return target;
1153 case NDS32_BUILTIN_SETEND_BIG:
1154 emit_insn (gen_unspec_setend_big ());
1155 return target;
1156 case NDS32_BUILTIN_SETEND_LITTLE:
1157 emit_insn (gen_unspec_setend_little ());
1158 return target;
1159 case NDS32_BUILTIN_NOP:
1160 emit_insn (gen_unspec_nop ());
1161 return target;
1162 case NDS32_BUILTIN_SCHE_BARRIER:
1163 emit_insn (gen_blockage ());
1164 return target;
1165 case NDS32_BUILTIN_TLBOP_FLUA:
1166 emit_insn (gen_unspec_tlbop_flua ());
1167 return target;
1168 case NDS32_BUILTIN_SCW:
1169 return nds32_expand_scw_builtin (CODE_FOR_unspec_volatile_scw,
1170 exp, target);
1171 case NDS32_BUILTIN_SET_INT_PRIORITY:
1172 return nds32_expand_priority_builtin (CODE_FOR_unspec_set_int_priority,
1173 exp, target,
1174 "__nds32__set_int_priority");
1175 return target;
1176 default:
1177 break;
1180 /* Expand groups of builtins. */
1181 for (i = 0, d = bdesc_noarg; i < ARRAY_SIZE (bdesc_noarg); i++, d++)
1182 if (d->code == fcode)
1183 return nds32_expand_noarg_builtin (d->icode, target);
1185 for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
1186 if (d->code == fcode)
1187 return nds32_expand_unop_builtin (d->icode, exp, target, d->return_p);
1189 for (i = 0, d = bdesc_1argimm; i < ARRAY_SIZE (bdesc_1argimm); i++, d++)
1190 if (d->code == fcode)
1191 return nds32_expand_unopimm_builtin (d->icode, exp, target,
1192 d->return_p, d->name);
1194 for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
1195 if (d->code == fcode)
1196 return nds32_expand_binop_builtin (d->icode, exp, target, d->return_p);
1198 for (i = 0, d = bdesc_2argimm; i < ARRAY_SIZE (bdesc_2argimm); i++, d++)
1199 if (d->code == fcode)
1200 return nds32_expand_binopimm_builtin (d->icode, exp, target,
1201 d->return_p, d->name);
1203 for (i = 0, d = bdesc_3arg; i < ARRAY_SIZE (bdesc_3arg); i++, d++)
1204 if (d->code == fcode)
1205 return nds32_expand_triop_builtin (d->icode, exp, target, d->return_p);
1207 for (i = 0, d = bdesc_3argimm; i < ARRAY_SIZE (bdesc_3argimm); i++, d++)
1208 if (d->code == fcode)
1209 return nds32_expand_triopimm_builtin (d->icode, exp, target,
1210 d->return_p, d->name);
1212 for (i = 0, d = bdesc_load; i < ARRAY_SIZE (bdesc_load); i++, d++)
1213 if (d->code == fcode)
1214 return nds32_expand_builtin_load (d->icode, exp, target);
1216 for (i = 0, d = bdesc_store; i < ARRAY_SIZE (bdesc_store); i++, d++)
1217 if (d->code == fcode)
1218 return nds32_expand_builtin_store (d->icode, exp, target);
1220 for (i = 0, d = bdesc_cctl; i < ARRAY_SIZE (bdesc_cctl); i++, d++)
1221 if (d->code == fcode)
1222 return nds32_expand_cctl_builtin (d->icode, exp, target,
1223 d->return_p, d->name);
1225 return NULL_RTX;
1228 static GTY(()) tree nds32_builtin_decls[NDS32_BUILTIN_COUNT];
1230 /* Return the NDS32 builtin for CODE. */
1231 tree
1232 nds32_builtin_decl_impl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
1234 if (code >= NDS32_BUILTIN_COUNT)
1235 return error_mark_node;
1237 return nds32_builtin_decls[code];
1240 void
1241 nds32_init_builtins_impl (void)
1243 #define ADD_NDS32_BUILTIN0(NAME, RET_TYPE, CODE) \
1244 nds32_builtin_decls[NDS32_BUILTIN_ ## CODE] = \
1245 add_builtin_function ("__builtin_nds32_" NAME, \
1246 build_function_type_list (RET_TYPE##_type_node, \
1247 NULL_TREE), \
1248 NDS32_BUILTIN_ ## CODE, BUILT_IN_MD, NULL, NULL_TREE)
1250 #define ADD_NDS32_BUILTIN1(NAME, RET_TYPE, ARG_TYPE, CODE) \
1251 nds32_builtin_decls[NDS32_BUILTIN_ ## CODE] = \
1252 add_builtin_function ("__builtin_nds32_" NAME, \
1253 build_function_type_list (RET_TYPE##_type_node, \
1254 ARG_TYPE##_type_node, \
1255 NULL_TREE), \
1256 NDS32_BUILTIN_ ## CODE, BUILT_IN_MD, NULL, NULL_TREE)
1258 #define ADD_NDS32_BUILTIN2(NAME, RET_TYPE, ARG_TYPE1, ARG_TYPE2, CODE) \
1259 nds32_builtin_decls[NDS32_BUILTIN_ ## CODE] = \
1260 add_builtin_function ("__builtin_nds32_" NAME, \
1261 build_function_type_list (RET_TYPE##_type_node, \
1262 ARG_TYPE1##_type_node,\
1263 ARG_TYPE2##_type_node,\
1264 NULL_TREE), \
1265 NDS32_BUILTIN_ ## CODE, BUILT_IN_MD, NULL, NULL_TREE)
1267 #define ADD_NDS32_BUILTIN3(NAME, RET_TYPE, \
1268 ARG_TYPE1, ARG_TYPE2, ARG_TYPE3, CODE) \
1269 nds32_builtin_decls[NDS32_BUILTIN_ ## CODE] = \
1270 add_builtin_function ("__builtin_nds32_" NAME, \
1271 build_function_type_list (RET_TYPE##_type_node, \
1272 ARG_TYPE1##_type_node,\
1273 ARG_TYPE2##_type_node,\
1274 ARG_TYPE3##_type_node,\
1275 NULL_TREE), \
1276 NDS32_BUILTIN_ ## CODE, BUILT_IN_MD, NULL, NULL_TREE)
1278 /* Looking for return type and argument can be found in tree.h file. */
1279 tree ptr_char_type_node = build_pointer_type (char_type_node);
1280 tree ptr_uchar_type_node = build_pointer_type (unsigned_char_type_node);
1281 tree ptr_ushort_type_node = build_pointer_type (short_unsigned_type_node);
1282 tree ptr_short_type_node = build_pointer_type (short_integer_type_node);
1283 tree ptr_uint_type_node = build_pointer_type (unsigned_type_node);
1284 tree ptr_ulong_type_node = build_pointer_type (long_long_unsigned_type_node);
1285 tree v4qi_type_node = build_vector_type (intQI_type_node, 4);
1286 tree u_v4qi_type_node = build_vector_type (unsigned_intQI_type_node, 4);
1287 tree v2hi_type_node = build_vector_type (intHI_type_node, 2);
1288 tree u_v2hi_type_node = build_vector_type (unsigned_intHI_type_node, 2);
1289 tree v2si_type_node = build_vector_type (intSI_type_node, 2);
1290 tree u_v2si_type_node = build_vector_type (unsigned_intSI_type_node, 2);
1292 /* Cache. */
1293 ADD_NDS32_BUILTIN1 ("isync", void, ptr_uint, ISYNC);
1294 ADD_NDS32_BUILTIN0 ("isb", void, ISB);
1295 ADD_NDS32_BUILTIN0 ("dsb", void, DSB);
1296 ADD_NDS32_BUILTIN0 ("msync_all", void, MSYNC_ALL);
1297 ADD_NDS32_BUILTIN0 ("msync_store", void, MSYNC_STORE);
1299 /* Register Transfer. */
1300 ADD_NDS32_BUILTIN1 ("mfsr", unsigned, integer, MFSR);
1301 ADD_NDS32_BUILTIN1 ("mfusr", unsigned, integer, MFUSR);
1302 ADD_NDS32_BUILTIN2 ("mtsr", void, unsigned, integer, MTSR);
1303 ADD_NDS32_BUILTIN2 ("mtsr_isb", void, unsigned, integer, MTSR_ISB);
1304 ADD_NDS32_BUILTIN2 ("mtsr_dsb", void, unsigned, integer, MTSR_DSB);
1305 ADD_NDS32_BUILTIN2 ("mtusr", void, unsigned, integer, MTUSR);
1307 /* FPU Register Transfer. */
1308 ADD_NDS32_BUILTIN0 ("fmfcsr", unsigned, FMFCSR);
1309 ADD_NDS32_BUILTIN1 ("fmtcsr", void, unsigned, FMTCSR);
1310 ADD_NDS32_BUILTIN0 ("fmfcfg", unsigned, FMFCFG);
1311 ADD_NDS32_BUILTIN2 ("fcpyss", float, float, float, FCPYSS);
1312 ADD_NDS32_BUILTIN2 ("fcpynss", float, float, float, FCPYNSS);
1313 ADD_NDS32_BUILTIN2 ("fcpysd", double, double, double, FCPYSD);
1314 ADD_NDS32_BUILTIN2 ("fcpynsd", double, double, double, FCPYNSD);
1316 /* Interrupt. */
1317 ADD_NDS32_BUILTIN0 ("setgie_en", void, SETGIE_EN);
1318 ADD_NDS32_BUILTIN0 ("setgie_dis", void, SETGIE_DIS);
1319 ADD_NDS32_BUILTIN0 ("gie_en", void, GIE_EN);
1320 ADD_NDS32_BUILTIN0 ("gie_dis", void, GIE_DIS);
1321 ADD_NDS32_BUILTIN1 ("enable_int", void, integer, ENABLE_INT);
1322 ADD_NDS32_BUILTIN1 ("disable_int", void, integer, DISABLE_INT);
1323 ADD_NDS32_BUILTIN0 ("set_pending_swint", void, SET_PENDING_SWINT);
1324 ADD_NDS32_BUILTIN0 ("clr_pending_swint", void, CLR_PENDING_SWINT);
1325 ADD_NDS32_BUILTIN0 ("get_all_pending_int", unsigned, GET_ALL_PENDING_INT);
1326 ADD_NDS32_BUILTIN1 ("get_pending_int", unsigned, integer, GET_PENDING_INT);
1327 ADD_NDS32_BUILTIN1 ("get_int_priority", unsigned, integer, GET_INT_PRIORITY);
1328 ADD_NDS32_BUILTIN2 ("set_int_priority", void, integer, integer,
1329 SET_INT_PRIORITY);
1330 ADD_NDS32_BUILTIN1 ("clr_pending_hwint", void, integer, CLR_PENDING_HWINT);
1331 ADD_NDS32_BUILTIN1 ("set_trig_level", void, integer, SET_TRIG_LEVEL);
1332 ADD_NDS32_BUILTIN1 ("set_trig_edge", void, integer, SET_TRIG_EDGE);
1333 ADD_NDS32_BUILTIN1 ("get_trig_type", unsigned, integer, GET_TRIG_TYPE);
1335 /* Load and Store */
1336 ADD_NDS32_BUILTIN1 ("llw", unsigned, ptr_uint, LLW);
1337 ADD_NDS32_BUILTIN1 ("lwup", unsigned, ptr_uint, LWUP);
1338 ADD_NDS32_BUILTIN1 ("lbup", char, ptr_uchar, LBUP);
1339 ADD_NDS32_BUILTIN2 ("scw", unsigned, ptr_uint, unsigned, SCW);
1340 ADD_NDS32_BUILTIN2 ("swup", void, ptr_uint, unsigned, SWUP);
1341 ADD_NDS32_BUILTIN2 ("sbup", void, ptr_uchar, char, SBUP);
1343 /* CCTL */
1344 ADD_NDS32_BUILTIN0 ("cctl_l1d_invalall", void, CCTL_L1D_INVALALL);
1345 ADD_NDS32_BUILTIN0 ("cctl_l1d_wball_alvl", void, CCTL_L1D_WBALL_ALVL);
1346 ADD_NDS32_BUILTIN0 ("cctl_l1d_wball_one_lvl", void, CCTL_L1D_WBALL_ONE_LVL);
1347 ADD_NDS32_BUILTIN2 ("cctl_va_lck", void, integer, ptr_uint, CCTL_VA_LCK);
1348 ADD_NDS32_BUILTIN2 ("cctl_idx_wbinval", void, integer, unsigned,
1349 CCTL_IDX_WBINVAL);
1350 ADD_NDS32_BUILTIN2 ("cctl_va_wbinval_l1", void, integer, ptr_uint,
1351 CCTL_VA_WBINVAL_L1);
1352 ADD_NDS32_BUILTIN2 ("cctl_va_wbinval_la", void, integer, ptr_uint,
1353 CCTL_VA_WBINVAL_LA);
1354 ADD_NDS32_BUILTIN2 ("cctl_idx_read", unsigned, integer, unsigned,
1355 CCTL_IDX_READ);
1356 ADD_NDS32_BUILTIN3 ("cctl_idx_write", void, integer, unsigned, unsigned,
1357 CCTL_IDX_WRITE);
1359 /* PREFETCH */
1360 ADD_NDS32_BUILTIN3 ("dpref_qw", void, ptr_uchar, unsigned, integer, DPREF_QW);
1361 ADD_NDS32_BUILTIN3 ("dpref_hw", void, ptr_ushort, unsigned, integer,
1362 DPREF_HW);
1363 ADD_NDS32_BUILTIN3 ("dpref_w", void, ptr_uint, unsigned, integer, DPREF_W);
1364 ADD_NDS32_BUILTIN3 ("dpref_dw", void, ptr_ulong, unsigned, integer, DPREF_DW);
1366 /* Performance Extension */
1367 ADD_NDS32_BUILTIN1 ("pe_abs", integer, integer, ABS);
1368 ADD_NDS32_BUILTIN2 ("pe_ave", integer, integer, integer, AVE);
1369 ADD_NDS32_BUILTIN2 ("pe_bclr", unsigned, unsigned, unsigned, BCLR);
1370 ADD_NDS32_BUILTIN2 ("pe_bset", unsigned, unsigned, unsigned, BSET);
1371 ADD_NDS32_BUILTIN2 ("pe_btgl", unsigned, unsigned, unsigned, BTGL);
1372 ADD_NDS32_BUILTIN2 ("pe_btst", unsigned, unsigned, unsigned, BTST);
1373 ADD_NDS32_BUILTIN2 ("pe_clip", unsigned, integer, unsigned, CLIP);
1374 ADD_NDS32_BUILTIN2 ("pe_clips", integer, integer, unsigned, CLIPS);
1375 ADD_NDS32_BUILTIN1 ("pe_clz", unsigned, unsigned, CLZ);
1376 ADD_NDS32_BUILTIN1 ("pe_clo", unsigned, unsigned, CLO);
1378 /* Performance Extension 2 */
1379 ADD_NDS32_BUILTIN3 ("pe2_bse", void, ptr_uint, unsigned, ptr_uint, BSE);
1380 ADD_NDS32_BUILTIN3 ("pe2_bsp", void, ptr_uint, unsigned, ptr_uint, BSP);
1381 ADD_NDS32_BUILTIN2 ("pe2_pbsad", unsigned, unsigned, unsigned, PBSAD);
1382 ADD_NDS32_BUILTIN3 ("pe2_pbsada", unsigned, unsigned, unsigned, unsigned,
1383 PBSADA);
1385 /* String Extension */
1386 ADD_NDS32_BUILTIN2 ("se_ffb", integer, unsigned, unsigned, FFB);
1387 ADD_NDS32_BUILTIN2 ("se_ffmism", integer, unsigned, unsigned, FFMISM);
1388 ADD_NDS32_BUILTIN2 ("se_flmism", integer, unsigned, unsigned, FLMISM);
1390 /* SATURATION */
1391 ADD_NDS32_BUILTIN2 ("kaddw", integer, integer, integer, KADDW);
1392 ADD_NDS32_BUILTIN2 ("ksubw", integer, integer, integer, KSUBW);
1393 ADD_NDS32_BUILTIN2 ("kaddh", integer, integer, integer, KADDH);
1394 ADD_NDS32_BUILTIN2 ("ksubh", integer, integer, integer, KSUBH);
1395 ADD_NDS32_BUILTIN2 ("kdmbb", integer, unsigned, unsigned, KDMBB);
1396 ADD_NDS32_BUILTIN2 ("v_kdmbb", integer, v2hi, v2hi, V_KDMBB);
1397 ADD_NDS32_BUILTIN2 ("kdmbt", integer, unsigned, unsigned, KDMBT);
1398 ADD_NDS32_BUILTIN2 ("v_kdmbt", integer, v2hi, v2hi, V_KDMBT);
1399 ADD_NDS32_BUILTIN2 ("kdmtb", integer, unsigned, unsigned, KDMTB);
1400 ADD_NDS32_BUILTIN2 ("v_kdmtb", integer, v2hi, v2hi, V_KDMTB);
1401 ADD_NDS32_BUILTIN2 ("kdmtt", integer, unsigned, unsigned, KDMTT);
1402 ADD_NDS32_BUILTIN2 ("v_kdmtt", integer, v2hi, v2hi, V_KDMTT);
1403 ADD_NDS32_BUILTIN2 ("khmbb", integer, unsigned, unsigned, KHMBB);
1404 ADD_NDS32_BUILTIN2 ("v_khmbb", integer, v2hi, v2hi, V_KHMBB);
1405 ADD_NDS32_BUILTIN2 ("khmbt", integer, unsigned, unsigned, KHMBT);
1406 ADD_NDS32_BUILTIN2 ("v_khmbt", integer, v2hi, v2hi, V_KHMBT);
1407 ADD_NDS32_BUILTIN2 ("khmtb", integer, unsigned, unsigned, KHMTB);
1408 ADD_NDS32_BUILTIN2 ("v_khmtb", integer, v2hi, v2hi, V_KHMTB);
1409 ADD_NDS32_BUILTIN2 ("khmtt", integer, unsigned, unsigned, KHMTT);
1410 ADD_NDS32_BUILTIN2 ("v_khmtt", integer, v2hi, v2hi, V_KHMTT);
1411 ADD_NDS32_BUILTIN2 ("kslraw", integer, integer, integer, KSLRAW);
1412 ADD_NDS32_BUILTIN2 ("kslraw_u", integer, integer, integer, KSLRAW_U);
1413 ADD_NDS32_BUILTIN0 ("rdov", unsigned, RDOV);
1414 ADD_NDS32_BUILTIN0 ("clrov", void, CLROV);
1416 /* ROTR */
1417 ADD_NDS32_BUILTIN2 ("rotr", unsigned, unsigned, unsigned, ROTR);
1419 /* Swap */
1420 ADD_NDS32_BUILTIN1 ("wsbh", unsigned, unsigned, WSBH);
1422 /* System */
1423 ADD_NDS32_BUILTIN2 ("svs", unsigned, integer, integer, SVS);
1424 ADD_NDS32_BUILTIN2 ("sva", unsigned, integer, integer, SVA);
1425 ADD_NDS32_BUILTIN1 ("jr_itoff", void, unsigned, JR_ITOFF);
1426 ADD_NDS32_BUILTIN1 ("jr_toff", void, unsigned, JR_TOFF);
1427 ADD_NDS32_BUILTIN1 ("jral_iton", void, unsigned, JRAL_ITON);
1428 ADD_NDS32_BUILTIN1 ("jral_ton", void, unsigned, JRAL_TON);
1429 ADD_NDS32_BUILTIN1 ("ret_itoff", void, unsigned, RET_ITOFF);
1430 ADD_NDS32_BUILTIN1 ("ret_toff", void, unsigned, RET_TOFF);
1431 ADD_NDS32_BUILTIN0 ("standby_no_wake_grant", void, STANDBY_NO_WAKE_GRANT);
1432 ADD_NDS32_BUILTIN0 ("standby_wake_grant", void, STANDBY_WAKE_GRANT);
1433 ADD_NDS32_BUILTIN0 ("standby_wait_done", void, STANDBY_WAKE_DONE);
1434 ADD_NDS32_BUILTIN1 ("break", void, unsigned, BREAK);
1435 ADD_NDS32_BUILTIN1 ("syscall", void, unsigned, SYSCALL);
1436 ADD_NDS32_BUILTIN0 ("nop", void, NOP);
1437 ADD_NDS32_BUILTIN0 ("get_current_sp", unsigned, GET_CURRENT_SP);
1438 ADD_NDS32_BUILTIN1 ("set_current_sp", void, unsigned, SET_CURRENT_SP);
1439 ADD_NDS32_BUILTIN2 ("teqz", void, unsigned, unsigned, TEQZ);
1440 ADD_NDS32_BUILTIN2 ("tnez", void, unsigned, unsigned, TNEZ);
1441 ADD_NDS32_BUILTIN1 ("trap", void, unsigned, TRAP);
1442 ADD_NDS32_BUILTIN0 ("return_address", unsigned, RETURN_ADDRESS);
1443 ADD_NDS32_BUILTIN0 ("setend_big", void, SETEND_BIG);
1444 ADD_NDS32_BUILTIN0 ("setend_little", void, SETEND_LITTLE);
1446 /* Schedule Barrier */
1447 ADD_NDS32_BUILTIN0 ("schedule_barrier", void, SCHE_BARRIER);
1449 /* TLBOP */
1450 ADD_NDS32_BUILTIN1 ("tlbop_trd", void, unsigned, TLBOP_TRD);
1451 ADD_NDS32_BUILTIN1 ("tlbop_twr", void, unsigned, TLBOP_TWR);
1452 ADD_NDS32_BUILTIN1 ("tlbop_rwr", void, unsigned, TLBOP_RWR);
1453 ADD_NDS32_BUILTIN1 ("tlbop_rwlk", void, unsigned, TLBOP_RWLK);
1454 ADD_NDS32_BUILTIN1 ("tlbop_unlk", void, unsigned, TLBOP_UNLK);
1455 ADD_NDS32_BUILTIN1 ("tlbop_pb", unsigned, unsigned, TLBOP_PB);
1456 ADD_NDS32_BUILTIN1 ("tlbop_inv", void, unsigned, TLBOP_INV);
1457 ADD_NDS32_BUILTIN0 ("tlbop_flua", void, TLBOP_FLUA);
1459 /* Unaligned Load/Store */
1460 ADD_NDS32_BUILTIN1 ("unaligned_load_hw", short_unsigned, ptr_ushort,
1461 UALOAD_HW);
1462 ADD_NDS32_BUILTIN1 ("unaligned_load_w", unsigned, ptr_uint, UALOAD_W);
1463 ADD_NDS32_BUILTIN1 ("unaligned_load_dw", long_long_unsigned, ptr_ulong,
1464 UALOAD_DW);
1465 ADD_NDS32_BUILTIN2 ("unaligned_store_hw", void, ptr_ushort, short_unsigned,
1466 UASTORE_HW);
1467 ADD_NDS32_BUILTIN2 ("unaligned_store_w", void, ptr_uint, unsigned, UASTORE_W);
1468 ADD_NDS32_BUILTIN2 ("unaligned_store_dw", void, ptr_ulong, long_long_unsigned,
1469 UASTORE_DW);
1470 ADD_NDS32_BUILTIN0 ("unaligned_feature", unsigned, UNALIGNED_FEATURE);
1471 ADD_NDS32_BUILTIN0 ("enable_unaligned", void, ENABLE_UNALIGNED);
1472 ADD_NDS32_BUILTIN0 ("disable_unaligned", void, DISABLE_UNALIGNED);
1474 /* DSP Extension: SIMD 16bit Add and Subtract. */
1475 ADD_NDS32_BUILTIN2 ("add16", unsigned, unsigned, unsigned, ADD16);
1476 ADD_NDS32_BUILTIN2 ("v_uadd16", u_v2hi, u_v2hi, u_v2hi, V_UADD16);
1477 ADD_NDS32_BUILTIN2 ("v_sadd16", v2hi, v2hi, v2hi, V_SADD16);
1478 ADD_NDS32_BUILTIN2 ("radd16", unsigned, unsigned, unsigned, RADD16);
1479 ADD_NDS32_BUILTIN2 ("v_radd16", v2hi, v2hi, v2hi, V_RADD16);
1480 ADD_NDS32_BUILTIN2 ("uradd16", unsigned, unsigned, unsigned, URADD16);
1481 ADD_NDS32_BUILTIN2 ("v_uradd16", u_v2hi, u_v2hi, u_v2hi, V_URADD16);
1482 ADD_NDS32_BUILTIN2 ("kadd16", unsigned, unsigned, unsigned, KADD16);
1483 ADD_NDS32_BUILTIN2 ("v_kadd16", v2hi, v2hi, v2hi, V_KADD16);
1484 ADD_NDS32_BUILTIN2 ("ukadd16", unsigned, unsigned, unsigned, UKADD16);
1485 ADD_NDS32_BUILTIN2 ("v_ukadd16", u_v2hi, u_v2hi, u_v2hi, V_UKADD16);
1486 ADD_NDS32_BUILTIN2 ("sub16", unsigned, unsigned, unsigned, SUB16);
1487 ADD_NDS32_BUILTIN2 ("v_usub16", u_v2hi, u_v2hi, u_v2hi, V_USUB16);
1488 ADD_NDS32_BUILTIN2 ("v_ssub16", v2hi, v2hi, v2hi, V_SSUB16);
1489 ADD_NDS32_BUILTIN2 ("rsub16", unsigned, unsigned, unsigned, RSUB16);
1490 ADD_NDS32_BUILTIN2 ("v_rsub16", v2hi, v2hi, v2hi, V_RSUB16);
1491 ADD_NDS32_BUILTIN2 ("ursub16", unsigned, unsigned, unsigned, URSUB16);
1492 ADD_NDS32_BUILTIN2 ("v_ursub16", u_v2hi, u_v2hi, u_v2hi, V_URSUB16);
1493 ADD_NDS32_BUILTIN2 ("ksub16", unsigned, unsigned, unsigned, KSUB16);
1494 ADD_NDS32_BUILTIN2 ("v_ksub16", v2hi, v2hi, v2hi, V_KSUB16);
1495 ADD_NDS32_BUILTIN2 ("uksub16", unsigned, unsigned, unsigned, UKSUB16);
1496 ADD_NDS32_BUILTIN2 ("v_uksub16", u_v2hi, u_v2hi, u_v2hi, V_UKSUB16);
1497 ADD_NDS32_BUILTIN2 ("cras16", unsigned, unsigned, unsigned, CRAS16);
1498 ADD_NDS32_BUILTIN2 ("v_ucras16", u_v2hi, u_v2hi, u_v2hi, V_UCRAS16);
1499 ADD_NDS32_BUILTIN2 ("v_scras16", v2hi, v2hi, v2hi, V_SCRAS16);
1500 ADD_NDS32_BUILTIN2 ("rcras16", unsigned, unsigned, unsigned, RCRAS16);
1501 ADD_NDS32_BUILTIN2 ("v_rcras16", v2hi, v2hi, v2hi, V_RCRAS16);
1502 ADD_NDS32_BUILTIN2 ("urcras16", unsigned, unsigned, unsigned, URCRAS16);
1503 ADD_NDS32_BUILTIN2 ("v_urcras16", u_v2hi, u_v2hi, u_v2hi, V_URCRAS16);
1504 ADD_NDS32_BUILTIN2 ("kcras16", unsigned, unsigned, unsigned, KCRAS16);
1505 ADD_NDS32_BUILTIN2 ("v_kcras16", v2hi, v2hi, v2hi, V_KCRAS16);
1506 ADD_NDS32_BUILTIN2 ("ukcras16", unsigned, unsigned, unsigned, UKCRAS16);
1507 ADD_NDS32_BUILTIN2 ("v_ukcras16", u_v2hi, u_v2hi, u_v2hi, V_UKCRAS16);
1508 ADD_NDS32_BUILTIN2 ("crsa16", unsigned, unsigned, unsigned, CRSA16);
1509 ADD_NDS32_BUILTIN2 ("v_ucrsa16", u_v2hi, u_v2hi, u_v2hi, V_UCRSA16);
1510 ADD_NDS32_BUILTIN2 ("v_scrsa16", v2hi, v2hi, v2hi, V_SCRSA16);
1511 ADD_NDS32_BUILTIN2 ("rcrsa16", unsigned, unsigned, unsigned, RCRSA16);
1512 ADD_NDS32_BUILTIN2 ("v_rcrsa16", v2hi, v2hi, v2hi, V_RCRSA16);
1513 ADD_NDS32_BUILTIN2 ("urcrsa16", unsigned, unsigned, unsigned, URCRSA16);
1514 ADD_NDS32_BUILTIN2 ("v_urcrsa16", u_v2hi, u_v2hi, u_v2hi, V_URCRSA16);
1515 ADD_NDS32_BUILTIN2 ("kcrsa16", unsigned, unsigned, unsigned, KCRSA16);
1516 ADD_NDS32_BUILTIN2 ("v_kcrsa16", v2hi, v2hi, v2hi, V_KCRSA16);
1517 ADD_NDS32_BUILTIN2 ("ukcrsa16", unsigned, unsigned, unsigned, UKCRSA16);
1518 ADD_NDS32_BUILTIN2 ("v_ukcrsa16", u_v2hi, u_v2hi, u_v2hi, V_UKCRSA16);
1520 /* DSP Extension: SIMD 8bit Add and Subtract. */
1521 ADD_NDS32_BUILTIN2 ("add8", integer, integer, integer, ADD8);
1522 ADD_NDS32_BUILTIN2 ("v_uadd8", u_v4qi, u_v4qi, u_v4qi, V_UADD8);
1523 ADD_NDS32_BUILTIN2 ("v_sadd8", v4qi, v4qi, v4qi, V_SADD8);
1524 ADD_NDS32_BUILTIN2 ("radd8", unsigned, unsigned, unsigned, RADD8);
1525 ADD_NDS32_BUILTIN2 ("v_radd8", v4qi, v4qi, v4qi, V_RADD8);
1526 ADD_NDS32_BUILTIN2 ("uradd8", unsigned, unsigned, unsigned, URADD8);
1527 ADD_NDS32_BUILTIN2 ("v_uradd8", u_v4qi, u_v4qi, u_v4qi, V_URADD8);
1528 ADD_NDS32_BUILTIN2 ("kadd8", unsigned, unsigned, unsigned, KADD8);
1529 ADD_NDS32_BUILTIN2 ("v_kadd8", v4qi, v4qi, v4qi, V_KADD8);
1530 ADD_NDS32_BUILTIN2 ("ukadd8", unsigned, unsigned, unsigned, UKADD8);
1531 ADD_NDS32_BUILTIN2 ("v_ukadd8", u_v4qi, u_v4qi, u_v4qi, V_UKADD8);
1532 ADD_NDS32_BUILTIN2 ("sub8", integer, integer, integer, SUB8);
1533 ADD_NDS32_BUILTIN2 ("v_usub8", u_v4qi, u_v4qi, u_v4qi, V_USUB8);
1534 ADD_NDS32_BUILTIN2 ("v_ssub8", v4qi, v4qi, v4qi, V_SSUB8);
1535 ADD_NDS32_BUILTIN2 ("rsub8", unsigned, unsigned, unsigned, RSUB8);
1536 ADD_NDS32_BUILTIN2 ("v_rsub8", v4qi, v4qi, v4qi, V_RSUB8);
1537 ADD_NDS32_BUILTIN2 ("ursub8", unsigned, unsigned, unsigned, URSUB8);
1538 ADD_NDS32_BUILTIN2 ("v_ursub8", u_v4qi, u_v4qi, u_v4qi, V_URSUB8);
1539 ADD_NDS32_BUILTIN2 ("ksub8", unsigned, unsigned, unsigned, KSUB8);
1540 ADD_NDS32_BUILTIN2 ("v_ksub8", v4qi, v4qi, v4qi, V_KSUB8);
1541 ADD_NDS32_BUILTIN2 ("uksub8", unsigned, unsigned, unsigned, UKSUB8);
1542 ADD_NDS32_BUILTIN2 ("v_uksub8", u_v4qi, u_v4qi, u_v4qi, V_UKSUB8);
1544 /* DSP Extension: SIMD 16bit Shift. */
1545 ADD_NDS32_BUILTIN2 ("sra16", unsigned, unsigned, unsigned, SRA16);
1546 ADD_NDS32_BUILTIN2 ("v_sra16", v2hi, v2hi, unsigned, V_SRA16);
1547 ADD_NDS32_BUILTIN2 ("sra16_u", unsigned, unsigned, unsigned, SRA16_U);
1548 ADD_NDS32_BUILTIN2 ("v_sra16_u", v2hi, v2hi, unsigned, V_SRA16_U);
1549 ADD_NDS32_BUILTIN2 ("srl16", unsigned, unsigned, unsigned, SRL16);
1550 ADD_NDS32_BUILTIN2 ("v_srl16", u_v2hi, u_v2hi, unsigned, V_SRL16);
1551 ADD_NDS32_BUILTIN2 ("srl16_u", unsigned, unsigned, unsigned, SRL16_U);
1552 ADD_NDS32_BUILTIN2 ("v_srl16_u", u_v2hi, u_v2hi, unsigned, V_SRL16_U);
1553 ADD_NDS32_BUILTIN2 ("sll16", unsigned, unsigned, unsigned, SLL16);
1554 ADD_NDS32_BUILTIN2 ("v_sll16", u_v2hi, u_v2hi, unsigned, V_SLL16);
1555 ADD_NDS32_BUILTIN2 ("ksll16", unsigned, unsigned, unsigned, KSLL16);
1556 ADD_NDS32_BUILTIN2 ("v_ksll16", v2hi, v2hi, unsigned, V_KSLL16);
1557 ADD_NDS32_BUILTIN2 ("kslra16", unsigned, unsigned, unsigned, KSLRA16);
1558 ADD_NDS32_BUILTIN2 ("v_kslra16", v2hi, v2hi, unsigned, V_KSLRA16);
1559 ADD_NDS32_BUILTIN2 ("kslra16_u", unsigned, unsigned, unsigned, KSLRA16_U);
1560 ADD_NDS32_BUILTIN2 ("v_kslra16_u", v2hi, v2hi, unsigned, V_KSLRA16_U);
1562 /* DSP Extension: 16bit Compare. */
1563 ADD_NDS32_BUILTIN2 ("cmpeq16", unsigned, unsigned, unsigned, CMPEQ16);
1564 ADD_NDS32_BUILTIN2 ("v_scmpeq16", u_v2hi, v2hi, v2hi, V_SCMPEQ16);
1565 ADD_NDS32_BUILTIN2 ("v_ucmpeq16", u_v2hi, u_v2hi, u_v2hi, V_UCMPEQ16);
1566 ADD_NDS32_BUILTIN2 ("scmplt16", unsigned, unsigned, unsigned, SCMPLT16);
1567 ADD_NDS32_BUILTIN2 ("v_scmplt16", u_v2hi, v2hi, v2hi, V_SCMPLT16);
1568 ADD_NDS32_BUILTIN2 ("scmple16", unsigned, unsigned, unsigned, SCMPLE16);
1569 ADD_NDS32_BUILTIN2 ("v_scmple16", u_v2hi, v2hi, v2hi, V_SCMPLE16);
1570 ADD_NDS32_BUILTIN2 ("ucmplt16", unsigned, unsigned, unsigned, UCMPLT16);
1571 ADD_NDS32_BUILTIN2 ("v_ucmplt16", u_v2hi, u_v2hi, u_v2hi, V_UCMPLT16);
1572 ADD_NDS32_BUILTIN2 ("ucmple16", unsigned, unsigned, unsigned, UCMPLE16);
1573 ADD_NDS32_BUILTIN2 ("v_ucmple16", u_v2hi, u_v2hi, u_v2hi, V_UCMPLE16);
1575 /* DSP Extension: 8bit Compare. */
1576 ADD_NDS32_BUILTIN2 ("cmpeq8", unsigned, unsigned, unsigned, CMPEQ8);
1577 ADD_NDS32_BUILTIN2 ("v_scmpeq8", u_v4qi, v4qi, v4qi, V_SCMPEQ8);
1578 ADD_NDS32_BUILTIN2 ("v_ucmpeq8", u_v4qi, u_v4qi, u_v4qi, V_UCMPEQ8);
1579 ADD_NDS32_BUILTIN2 ("scmplt8", unsigned, unsigned, unsigned, SCMPLT8);
1580 ADD_NDS32_BUILTIN2 ("v_scmplt8", u_v4qi, v4qi, v4qi, V_SCMPLT8);
1581 ADD_NDS32_BUILTIN2 ("scmple8", unsigned, unsigned, unsigned, SCMPLE8);
1582 ADD_NDS32_BUILTIN2 ("v_scmple8", u_v4qi, v4qi, v4qi, V_SCMPLE8);
1583 ADD_NDS32_BUILTIN2 ("ucmplt8", unsigned, unsigned, unsigned, UCMPLT8);
1584 ADD_NDS32_BUILTIN2 ("v_ucmplt8", u_v4qi, u_v4qi, u_v4qi, V_UCMPLT8);
1585 ADD_NDS32_BUILTIN2 ("ucmple8", unsigned, unsigned, unsigned, UCMPLE8);
1586 ADD_NDS32_BUILTIN2 ("v_ucmple8", u_v4qi, u_v4qi, u_v4qi, V_UCMPLE8);
1588 /* DSP Extension: SIMD 16bit MISC. */
1589 ADD_NDS32_BUILTIN2 ("smin16", unsigned, unsigned, unsigned, SMIN16);
1590 ADD_NDS32_BUILTIN2 ("v_smin16", v2hi, v2hi, v2hi, V_SMIN16);
1591 ADD_NDS32_BUILTIN2 ("umin16", unsigned, unsigned, unsigned, UMIN16);
1592 ADD_NDS32_BUILTIN2 ("v_umin16", u_v2hi, u_v2hi, u_v2hi, V_UMIN16);
1593 ADD_NDS32_BUILTIN2 ("smax16", unsigned, unsigned, unsigned, SMAX16);
1594 ADD_NDS32_BUILTIN2 ("v_smax16", v2hi, v2hi, v2hi, V_SMAX16);
1595 ADD_NDS32_BUILTIN2 ("umax16", unsigned, unsigned, unsigned, UMAX16);
1596 ADD_NDS32_BUILTIN2 ("v_umax16", u_v2hi, u_v2hi, u_v2hi, V_UMAX16);
1597 ADD_NDS32_BUILTIN2 ("sclip16", unsigned, unsigned, unsigned, SCLIP16);
1598 ADD_NDS32_BUILTIN2 ("v_sclip16", v2hi, v2hi, unsigned, V_SCLIP16);
1599 ADD_NDS32_BUILTIN2 ("uclip16", unsigned, unsigned, unsigned, UCLIP16);
1600 ADD_NDS32_BUILTIN2 ("v_uclip16", v2hi, v2hi, unsigned, V_UCLIP16);
1601 ADD_NDS32_BUILTIN2 ("khm16", unsigned, unsigned, unsigned, KHM16);
1602 ADD_NDS32_BUILTIN2 ("v_khm16", v2hi, v2hi, v2hi, V_KHM16);
1603 ADD_NDS32_BUILTIN2 ("khmx16", unsigned, unsigned, unsigned, KHMX16);
1604 ADD_NDS32_BUILTIN2 ("v_khmx16", v2hi, v2hi, v2hi, V_KHMX16);
1605 ADD_NDS32_BUILTIN1 ("kabs16", unsigned, unsigned, KABS16);
1606 ADD_NDS32_BUILTIN1 ("v_kabs16", v2hi, v2hi, V_KABS16);
1607 ADD_NDS32_BUILTIN2 ("smul16", long_long_unsigned, unsigned, unsigned, SMUL16);
1608 ADD_NDS32_BUILTIN2 ("v_smul16", v2si, v2hi, v2hi, V_SMUL16);
1609 ADD_NDS32_BUILTIN2 ("smulx16",
1610 long_long_unsigned, unsigned, unsigned, SMULX16);
1611 ADD_NDS32_BUILTIN2 ("v_smulx16", v2si, v2hi, v2hi, V_SMULX16);
1612 ADD_NDS32_BUILTIN2 ("umul16", long_long_unsigned, unsigned, unsigned, UMUL16);
1613 ADD_NDS32_BUILTIN2 ("v_umul16", u_v2si, u_v2hi, u_v2hi, V_UMUL16);
1614 ADD_NDS32_BUILTIN2 ("umulx16",
1615 long_long_unsigned, unsigned, unsigned, UMULX16);
1616 ADD_NDS32_BUILTIN2 ("v_umulx16", u_v2si, u_v2hi, u_v2hi, V_UMULX16);
1618 /* DSP Extension: SIMD 8bit MISC. */
1619 ADD_NDS32_BUILTIN2 ("smin8", unsigned, unsigned, unsigned, SMIN8);
1620 ADD_NDS32_BUILTIN2 ("v_smin8", v4qi, v4qi, v4qi, V_SMIN8);
1621 ADD_NDS32_BUILTIN2 ("umin8", unsigned, unsigned, unsigned, UMIN8);
1622 ADD_NDS32_BUILTIN2 ("v_umin8", u_v4qi, u_v4qi, u_v4qi, V_UMIN8);
1623 ADD_NDS32_BUILTIN2 ("smax8", unsigned, unsigned, unsigned, SMAX8);
1624 ADD_NDS32_BUILTIN2 ("v_smax8", v4qi, v4qi, v4qi, V_SMAX8);
1625 ADD_NDS32_BUILTIN2 ("umax8", unsigned, unsigned, unsigned, UMAX8);
1626 ADD_NDS32_BUILTIN2 ("v_umax8", u_v4qi, u_v4qi, u_v4qi, V_UMAX8);
1627 ADD_NDS32_BUILTIN1 ("kabs8", unsigned, unsigned, KABS8);
1628 ADD_NDS32_BUILTIN1 ("v_kabs8", v4qi, v4qi, V_KABS8);
1630 /* DSP Extension: 8bit Unpacking. */
1631 ADD_NDS32_BUILTIN1 ("sunpkd810", unsigned, unsigned, SUNPKD810);
1632 ADD_NDS32_BUILTIN1 ("v_sunpkd810", v2hi, v4qi, V_SUNPKD810);
1633 ADD_NDS32_BUILTIN1 ("sunpkd820", unsigned, unsigned, SUNPKD820);
1634 ADD_NDS32_BUILTIN1 ("v_sunpkd820", v2hi, v4qi, V_SUNPKD820);
1635 ADD_NDS32_BUILTIN1 ("sunpkd830", unsigned, unsigned, SUNPKD830);
1636 ADD_NDS32_BUILTIN1 ("v_sunpkd830", v2hi, v4qi, V_SUNPKD830);
1637 ADD_NDS32_BUILTIN1 ("sunpkd831", unsigned, unsigned, SUNPKD831);
1638 ADD_NDS32_BUILTIN1 ("v_sunpkd831", v2hi, v4qi, V_SUNPKD831);
1639 ADD_NDS32_BUILTIN1 ("zunpkd810", unsigned, unsigned, ZUNPKD810);
1640 ADD_NDS32_BUILTIN1 ("v_zunpkd810", u_v2hi, u_v4qi, V_ZUNPKD810);
1641 ADD_NDS32_BUILTIN1 ("zunpkd820", unsigned, unsigned, ZUNPKD820);
1642 ADD_NDS32_BUILTIN1 ("v_zunpkd820", u_v2hi, u_v4qi, V_ZUNPKD820);
1643 ADD_NDS32_BUILTIN1 ("zunpkd830", unsigned, unsigned, ZUNPKD830);
1644 ADD_NDS32_BUILTIN1 ("v_zunpkd830", u_v2hi, u_v4qi, V_ZUNPKD830);
1645 ADD_NDS32_BUILTIN1 ("zunpkd831", unsigned, unsigned, ZUNPKD831);
1646 ADD_NDS32_BUILTIN1 ("v_zunpkd831", u_v2hi, u_v4qi, V_ZUNPKD831);
1648 /* DSP Extension: 32bit Add and Subtract. */
1649 ADD_NDS32_BUILTIN2 ("raddw", integer, integer, integer, RADDW);
1650 ADD_NDS32_BUILTIN2 ("uraddw", unsigned, unsigned, unsigned, URADDW);
1651 ADD_NDS32_BUILTIN2 ("rsubw", integer, integer, integer, RSUBW);
1652 ADD_NDS32_BUILTIN2 ("ursubw", unsigned, unsigned, unsigned, URSUBW);
1654 /* DSP Extension: 32bit Shift. */
1655 ADD_NDS32_BUILTIN2 ("sra_u", integer, integer, unsigned, SRA_U);
1656 ADD_NDS32_BUILTIN2 ("ksll", integer, integer, unsigned, KSLL);
1658 /* DSP Extension: 16bit Packing. */
1659 ADD_NDS32_BUILTIN2 ("pkbb16", unsigned, unsigned, unsigned, PKBB16);
1660 ADD_NDS32_BUILTIN2 ("v_pkbb16", u_v2hi, u_v2hi, u_v2hi, V_PKBB16);
1661 ADD_NDS32_BUILTIN2 ("pkbt16", unsigned, unsigned, unsigned, PKBT16);
1662 ADD_NDS32_BUILTIN2 ("v_pkbt16", u_v2hi, u_v2hi, u_v2hi, V_PKBT16);
1663 ADD_NDS32_BUILTIN2 ("pktb16", unsigned, unsigned, unsigned, PKTB16);
1664 ADD_NDS32_BUILTIN2 ("v_pktb16", u_v2hi, u_v2hi, u_v2hi, V_PKTB16);
1665 ADD_NDS32_BUILTIN2 ("pktt16", unsigned, unsigned, unsigned, PKTT16);
1666 ADD_NDS32_BUILTIN2 ("v_pktt16", u_v2hi, u_v2hi, u_v2hi, V_PKTT16);
1668 /* DSP Extension: Signed MSW 32x32 Multiply and ADD. */
1669 ADD_NDS32_BUILTIN2 ("smmul", integer, integer, integer, SMMUL);
1670 ADD_NDS32_BUILTIN2 ("smmul_u", integer, integer, integer, SMMUL_U);
1671 ADD_NDS32_BUILTIN3 ("kmmac", integer, integer, integer, integer, KMMAC);
1672 ADD_NDS32_BUILTIN3 ("kmmac_u", integer, integer, integer, integer, KMMAC_U);
1673 ADD_NDS32_BUILTIN3 ("kmmsb", integer, integer, integer, integer, KMMSB);
1674 ADD_NDS32_BUILTIN3 ("kmmsb_u", integer, integer, integer, integer, KMMSB_U);
1675 ADD_NDS32_BUILTIN2 ("kwmmul", integer, integer, integer, KWMMUL);
1676 ADD_NDS32_BUILTIN2 ("kwmmul_u", integer, integer, integer, KWMMUL_U);
1678 /* DSP Extension: Most Significant Word 32x16 Multiply and ADD. */
1679 ADD_NDS32_BUILTIN2 ("smmwb", integer, integer, unsigned, SMMWB);
1680 ADD_NDS32_BUILTIN2 ("v_smmwb", integer, integer, v2hi, V_SMMWB);
1681 ADD_NDS32_BUILTIN2 ("smmwb_u", integer, integer, unsigned, SMMWB_U);
1682 ADD_NDS32_BUILTIN2 ("v_smmwb_u", integer, integer, v2hi, V_SMMWB_U);
1683 ADD_NDS32_BUILTIN2 ("smmwt", integer, integer, unsigned, SMMWT);
1684 ADD_NDS32_BUILTIN2 ("v_smmwt", integer, integer, v2hi, V_SMMWT);
1685 ADD_NDS32_BUILTIN2 ("smmwt_u", integer, integer, unsigned, SMMWT_U);
1686 ADD_NDS32_BUILTIN2 ("v_smmwt_u", integer, integer, v2hi, V_SMMWT_U);
1687 ADD_NDS32_BUILTIN3 ("kmmawb", integer, integer, integer, unsigned, KMMAWB);
1688 ADD_NDS32_BUILTIN3 ("v_kmmawb", integer, integer, integer, v2hi, V_KMMAWB);
1689 ADD_NDS32_BUILTIN3 ("kmmawb_u",
1690 integer, integer, integer, unsigned, KMMAWB_U);
1691 ADD_NDS32_BUILTIN3 ("v_kmmawb_u",
1692 integer, integer, integer, v2hi, V_KMMAWB_U);
1693 ADD_NDS32_BUILTIN3 ("kmmawt", integer, integer, integer, unsigned, KMMAWT);
1694 ADD_NDS32_BUILTIN3 ("v_kmmawt", integer, integer, integer, v2hi, V_KMMAWT);
1695 ADD_NDS32_BUILTIN3 ("kmmawt_u",
1696 integer, integer, integer, unsigned, KMMAWT_U);
1697 ADD_NDS32_BUILTIN3 ("v_kmmawt_u",
1698 integer, integer, integer, v2hi, V_KMMAWT_U);
1700 /* DSP Extension: Signed 16bit Multiply with ADD/Subtract. */
1701 ADD_NDS32_BUILTIN2 ("smbb", integer, unsigned, unsigned, SMBB);
1702 ADD_NDS32_BUILTIN2 ("v_smbb", integer, v2hi, v2hi, V_SMBB);
1703 ADD_NDS32_BUILTIN2 ("smbt", integer, unsigned, unsigned, SMBT);
1704 ADD_NDS32_BUILTIN2 ("v_smbt", integer, v2hi, v2hi, V_SMBT);
1705 ADD_NDS32_BUILTIN2 ("smtt", integer, unsigned, unsigned, SMTT);
1706 ADD_NDS32_BUILTIN2 ("v_smtt", integer, v2hi, v2hi, V_SMTT);
1707 ADD_NDS32_BUILTIN2 ("kmda", integer, unsigned, unsigned, KMDA);
1708 ADD_NDS32_BUILTIN2 ("v_kmda", integer, v2hi, v2hi, V_KMDA);
1709 ADD_NDS32_BUILTIN2 ("kmxda", integer, unsigned, unsigned, KMXDA);
1710 ADD_NDS32_BUILTIN2 ("v_kmxda", integer, v2hi, v2hi, V_KMXDA);
1711 ADD_NDS32_BUILTIN2 ("smds", integer, unsigned, unsigned, SMDS);
1712 ADD_NDS32_BUILTIN2 ("v_smds", integer, v2hi, v2hi, V_SMDS);
1713 ADD_NDS32_BUILTIN2 ("smdrs", integer, unsigned, unsigned, SMDRS);
1714 ADD_NDS32_BUILTIN2 ("v_smdrs", integer, v2hi, v2hi, V_SMDRS);
1715 ADD_NDS32_BUILTIN2 ("smxds", integer, unsigned, unsigned, SMXDS);
1716 ADD_NDS32_BUILTIN2 ("v_smxds", integer, v2hi, v2hi, V_SMXDS);
1717 ADD_NDS32_BUILTIN3 ("kmabb", integer, integer, unsigned, unsigned, KMABB);
1718 ADD_NDS32_BUILTIN3 ("v_kmabb", integer, integer, v2hi, v2hi, V_KMABB);
1719 ADD_NDS32_BUILTIN3 ("kmabt", integer, integer, unsigned, unsigned, KMABT);
1720 ADD_NDS32_BUILTIN3 ("v_kmabt", integer, integer, v2hi, v2hi, V_KMABT);
1721 ADD_NDS32_BUILTIN3 ("kmatt", integer, integer, unsigned, unsigned, KMATT);
1722 ADD_NDS32_BUILTIN3 ("v_kmatt", integer, integer, v2hi, v2hi, V_KMATT);
1723 ADD_NDS32_BUILTIN3 ("kmada", integer, integer, unsigned, unsigned, KMADA);
1724 ADD_NDS32_BUILTIN3 ("v_kmada", integer, integer, v2hi, v2hi, V_KMADA);
1725 ADD_NDS32_BUILTIN3 ("kmaxda", integer, integer, unsigned, unsigned, KMAXDA);
1726 ADD_NDS32_BUILTIN3 ("v_kmaxda", integer, integer, v2hi, v2hi, V_KMAXDA);
1727 ADD_NDS32_BUILTIN3 ("kmads", integer, integer, unsigned, unsigned, KMADS);
1728 ADD_NDS32_BUILTIN3 ("v_kmads", integer, integer, v2hi, v2hi, V_KMADS);
1729 ADD_NDS32_BUILTIN3 ("kmadrs", integer, integer, unsigned, unsigned, KMADRS);
1730 ADD_NDS32_BUILTIN3 ("v_kmadrs", integer, integer, v2hi, v2hi, V_KMADRS);
1731 ADD_NDS32_BUILTIN3 ("kmaxds", integer, integer, unsigned, unsigned, KMAXDS);
1732 ADD_NDS32_BUILTIN3 ("v_kmaxds", integer, integer, v2hi, v2hi, V_KMAXDS);
1733 ADD_NDS32_BUILTIN3 ("kmsda", integer, integer, unsigned, unsigned, KMSDA);
1734 ADD_NDS32_BUILTIN3 ("v_kmsda", integer, integer, v2hi, v2hi, V_KMSDA);
1735 ADD_NDS32_BUILTIN3 ("kmsxda", integer, integer, unsigned, unsigned, KMSXDA);
1736 ADD_NDS32_BUILTIN3 ("v_kmsxda", integer, integer, v2hi, v2hi, V_KMSXDA);
1738 /* DSP Extension: Signed 16bit Multiply with 64bit ADD/Subtract. */
1739 ADD_NDS32_BUILTIN2 ("smal", long_long_integer,
1740 long_long_integer, unsigned, SMAL);
1741 ADD_NDS32_BUILTIN2 ("v_smal", long_long_integer,
1742 long_long_integer, v2hi, V_SMAL);
1744 /* DSP Extension: 32bit MISC. */
1745 ADD_NDS32_BUILTIN2 ("bitrev", unsigned, unsigned, unsigned, BITREV);
1746 ADD_NDS32_BUILTIN2 ("wext", unsigned, long_long_integer, unsigned, WEXT);
1747 ADD_NDS32_BUILTIN3 ("bpick", unsigned, unsigned, unsigned, unsigned, BPICK);
1748 ADD_NDS32_BUILTIN3 ("insb", unsigned, unsigned, unsigned, unsigned, INSB);
1750 /* DSP Extension: 64bit Add and Subtract. */
1751 ADD_NDS32_BUILTIN2 ("sadd64", long_long_integer,
1752 long_long_integer, long_long_integer, SADD64);
1753 ADD_NDS32_BUILTIN2 ("uadd64", long_long_unsigned,
1754 long_long_unsigned, long_long_unsigned, UADD64);
1755 ADD_NDS32_BUILTIN2 ("radd64", long_long_integer,
1756 long_long_integer, long_long_integer, RADD64);
1757 ADD_NDS32_BUILTIN2 ("uradd64", long_long_unsigned,
1758 long_long_unsigned, long_long_unsigned, URADD64);
1759 ADD_NDS32_BUILTIN2 ("kadd64", long_long_integer,
1760 long_long_integer, long_long_integer, KADD64);
1761 ADD_NDS32_BUILTIN2 ("ukadd64", long_long_unsigned,
1762 long_long_unsigned, long_long_unsigned, UKADD64);
1763 ADD_NDS32_BUILTIN2 ("ssub64", long_long_integer,
1764 long_long_integer, long_long_integer, SSUB64);
1765 ADD_NDS32_BUILTIN2 ("usub64", long_long_unsigned,
1766 long_long_unsigned, long_long_unsigned, USUB64);
1767 ADD_NDS32_BUILTIN2 ("rsub64", long_long_integer,
1768 long_long_integer, long_long_integer, RSUB64);
1769 ADD_NDS32_BUILTIN2 ("ursub64", long_long_unsigned,
1770 long_long_unsigned, long_long_unsigned, URSUB64);
1771 ADD_NDS32_BUILTIN2 ("ksub64", long_long_integer,
1772 long_long_integer, long_long_integer, KSUB64);
1773 ADD_NDS32_BUILTIN2 ("uksub64", long_long_unsigned,
1774 long_long_unsigned, long_long_unsigned, UKSUB64);
1776 /* DSP Extension: 32bit Multiply with 64bit Add/Subtract. */
1777 ADD_NDS32_BUILTIN3 ("smar64", long_long_integer,
1778 long_long_integer, integer, integer, SMAR64);
1779 ADD_NDS32_BUILTIN3 ("smsr64", long_long_integer,
1780 long_long_integer, integer, integer, SMSR64);
1781 ADD_NDS32_BUILTIN3 ("umar64", long_long_unsigned,
1782 long_long_unsigned, unsigned, unsigned, UMAR64);
1783 ADD_NDS32_BUILTIN3 ("umsr64", long_long_unsigned,
1784 long_long_unsigned, unsigned, unsigned, UMSR64);
1785 ADD_NDS32_BUILTIN3 ("kmar64", long_long_integer,
1786 long_long_integer, integer, integer, KMAR64);
1787 ADD_NDS32_BUILTIN3 ("kmsr64", long_long_integer,
1788 long_long_integer, integer, integer, KMSR64);
1789 ADD_NDS32_BUILTIN3 ("ukmar64", long_long_unsigned,
1790 long_long_unsigned, unsigned, unsigned, UKMAR64);
1791 ADD_NDS32_BUILTIN3 ("ukmsr64", long_long_unsigned,
1792 long_long_unsigned, unsigned, unsigned, UKMSR64);
1794 /* DSP Extension: Signed 16bit Multiply with 64bit Add/Subtract. */
1795 ADD_NDS32_BUILTIN3 ("smalbb", long_long_integer,
1796 long_long_integer, unsigned, unsigned, SMALBB);
1797 ADD_NDS32_BUILTIN3 ("v_smalbb", long_long_integer,
1798 long_long_integer, v2hi, v2hi, V_SMALBB);
1799 ADD_NDS32_BUILTIN3 ("smalbt", long_long_integer,
1800 long_long_integer, unsigned, unsigned, SMALBT);
1801 ADD_NDS32_BUILTIN3 ("v_smalbt", long_long_integer,
1802 long_long_integer, v2hi, v2hi, V_SMALBT);
1803 ADD_NDS32_BUILTIN3 ("smaltt", long_long_integer,
1804 long_long_integer, unsigned, unsigned, SMALTT);
1805 ADD_NDS32_BUILTIN3 ("v_smaltt", long_long_integer,
1806 long_long_integer, v2hi, v2hi, V_SMALTT);
1807 ADD_NDS32_BUILTIN3 ("smalda", long_long_integer,
1808 long_long_integer, unsigned, unsigned, SMALDA);
1809 ADD_NDS32_BUILTIN3 ("v_smalda", long_long_integer,
1810 long_long_integer, v2hi, v2hi, V_SMALDA);
1811 ADD_NDS32_BUILTIN3 ("smalxda", long_long_integer,
1812 long_long_integer, unsigned, unsigned, SMALXDA);
1813 ADD_NDS32_BUILTIN3 ("v_smalxda", long_long_integer,
1814 long_long_integer, v2hi, v2hi, V_SMALXDA);
1815 ADD_NDS32_BUILTIN3 ("smalds", long_long_integer,
1816 long_long_integer, unsigned, unsigned, SMALDS);
1817 ADD_NDS32_BUILTIN3 ("v_smalds", long_long_integer,
1818 long_long_integer, v2hi, v2hi, V_SMALDS);
1819 ADD_NDS32_BUILTIN3 ("smaldrs", long_long_integer,
1820 long_long_integer, unsigned, unsigned, SMALDRS);
1821 ADD_NDS32_BUILTIN3 ("v_smaldrs", long_long_integer,
1822 long_long_integer, v2hi, v2hi, V_SMALDRS);
1823 ADD_NDS32_BUILTIN3 ("smalxds", long_long_integer,
1824 long_long_integer, unsigned, unsigned, SMALXDS);
1825 ADD_NDS32_BUILTIN3 ("v_smalxds", long_long_integer,
1826 long_long_integer, v2hi, v2hi, V_SMALXDS);
1827 ADD_NDS32_BUILTIN3 ("smslda", long_long_integer,
1828 long_long_integer, unsigned, unsigned, SMSLDA);
1829 ADD_NDS32_BUILTIN3 ("v_smslda", long_long_integer,
1830 long_long_integer, v2hi, v2hi, V_SMSLDA);
1831 ADD_NDS32_BUILTIN3 ("smslxda", long_long_integer,
1832 long_long_integer, unsigned, unsigned, SMSLXDA);
1833 ADD_NDS32_BUILTIN3 ("v_smslxda", long_long_integer,
1834 long_long_integer, v2hi, v2hi, V_SMSLXDA);
1836 /* DSP Extension: augmented baseline. */
1837 ADD_NDS32_BUILTIN2 ("uclip32", unsigned, integer, unsigned, UCLIP32);
1838 ADD_NDS32_BUILTIN2 ("sclip32", integer, integer, unsigned, SCLIP32);
1839 ADD_NDS32_BUILTIN1 ("kabs", integer, integer, KABS);
1841 /* DSP Extension: vector type unaligned Load/Store */
1842 ADD_NDS32_BUILTIN1 ("get_unaligned_u16x2", u_v2hi, ptr_ushort, UALOAD_U16);
1843 ADD_NDS32_BUILTIN1 ("get_unaligned_s16x2", v2hi, ptr_short, UALOAD_S16);
1844 ADD_NDS32_BUILTIN1 ("get_unaligned_u8x4", u_v4qi, ptr_uchar, UALOAD_U8);
1845 ADD_NDS32_BUILTIN1 ("get_unaligned_s8x4", v4qi, ptr_char, UALOAD_S8);
1846 ADD_NDS32_BUILTIN2 ("put_unaligned_u16x2", void, ptr_ushort,
1847 u_v2hi, UASTORE_U16);
1848 ADD_NDS32_BUILTIN2 ("put_unaligned_s16x2", void, ptr_short,
1849 v2hi, UASTORE_S16);
1850 ADD_NDS32_BUILTIN2 ("put_unaligned_u8x4", void, ptr_uchar,
1851 u_v4qi, UASTORE_U8);
1852 ADD_NDS32_BUILTIN2 ("put_unaligned_s8x4", void, ptr_char,
1853 v4qi, UASTORE_S8);