codegen: use the and instruction when doing zero-extend
[ajla.git] / ipret-a1.inc
blob00416d047d51880ff35bfe89edaef22fb6cb3164
1 /*
2  * Copyright (C) 2024 Mikulas Patocka
3  *
4  * This file is part of Ajla.
5  *
6  * Ajla is free software: you can redistribute it and/or modify it under the
7  * terms of the GNU General Public License as published by the Free Software
8  * Foundation, either version 3 of the License, or (at your option) any later
9  * version.
10  *
11  * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * Ajla. If not, see <https://www.gnu.org/licenses/>.
17  */
19 #define OPC(op)         (OPCODE_FIXED_OP + cat(OPCODE_FIXED_OP_,op) * OPCODE_FIXED_OP_MULT + cat(OPCODE_FIXED_TYPE_,type) * OPCODE_FIXED_TYPE_MULT)
21 #define orig_op         divide
22 #define op              divide_alt1
23 #define OPF             FIXED_DIVIDE_ALT1_
24 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(FIXED_, type, op)
25 #include "ipret-b1.inc"
27 #define orig_op         udivide
28 #define op              udivide_alt1
29 #define OPF             FIXED_UDIVIDE_ALT1_
30 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(FIXED_, type, op)
31 #include "ipret-b1.inc"
33 #define orig_op         modulo
34 #define op              modulo_alt1
35 #define OPF             FIXED_MODULO_ALT1_
36 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(FIXED_, type, op)
37 #include "ipret-b1.inc"
39 #define orig_op         umodulo
40 #define op              umodulo_alt1
41 #define OPF             FIXED_UMODULO_ALT1_
42 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(FIXED_, type, op)
43 #include "ipret-b1.inc"
45 #define orig_op         bswap
46 #define op              bswap_alt1
47 #define OPF             FIXED_BSWAP_ALT1_
48 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(FIXED_, type, op)
49 #include "ipret-b1.inc"
51 #define orig_op         brev
52 #define op              brev_alt1
53 #define OPF             FIXED_BREV_ALT1_
54 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(FIXED_, type, op)
55 #include "ipret-b1.inc"
57 #define orig_op         bsf
58 #define op              bsf_alt1
59 #define OPF             FIXED_BSF_ALT1_
60 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(FIXED_, type, op)
61 #include "ipret-b1.inc"
63 #define orig_op         bsr
64 #define op              bsr_alt1
65 #define OPF             FIXED_BSR_ALT1_
66 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(FIXED_, type, op)
67 #include "ipret-b1.inc"
69 #define orig_op         popcnt
70 #define op              popcnt_alt1
71 #define OPF             FIXED_POPCNT_ALT1_
72 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(FIXED_, type, op)
73 #include "ipret-b1.inc"
75 #undef OPC