1;; builtin definitions for DEC VAX. 2;; Copyright (C) 2007-2020 Free Software Foundation, Inc. 3;; 4;; This file is part of GCC. 5;; 6;; GCC is free software; you can redistribute it and/or modify it under 7;; the terms of the GNU General Public License as published by the Free 8;; Software Foundation; either version 3, or (at your option) any later 9;; version. 10;; 11;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY 12;; WARRANTY; without even the implied warranty of MERCHANTABILITY or 13;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14;; for more details. 15;; 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/>. 19 20(define_constants 21 [ 22 (VUNSPEC_LOCK 100) ; sync lock and test 23 (VUNSPEC_UNLOCK 101) ; sync lock release 24 ] 25) 26 27(define_expand "condjump" 28 [(set (pc) 29 (if_then_else (match_operand 0) 30 (label_ref (match_operand 1)) 31 (pc)))]) 32 33(define_expand "ffssi2" 34 [(set (match_operand:SI 0 "nonimmediate_operand" "") 35 (ffs:SI (match_operand:SI 1 "general_operand" ""))) 36 (set (cc0) 37 (compare (match_dup 0) (const_int 0))) 38 ] 39 "" 40 " 41{ 42 rtx label = gen_label_rtx (); 43 emit_insn (gen_count_zero (operands[0], operands[1])); 44 emit_jump_insn (gen_condjump (gen_rtx_NE(VOIDmode, cc0_rtx, const0_rtx), label)); 45 emit_move_insn (operands[0], constm1_rtx); 46 emit_label (label); 47 emit_insn (gen_addsi3 (operands[0], operands[0], const1_rtx)); 48 DONE; 49}") 50 51(define_insn "ctzsi2" 52 [(set (match_operand:SI 0 "nonimmediate_operand" "=rQ") 53 (ctz:SI (match_operand:SI 1 "general_operand" "nrQT"))) 54 (set (cc0) 55 (compare (match_dup 0) (const_int 0))) 56 ] 57 "" 58 "ffs $0,$32,%1,%0\;tstl %0") 59 60(define_insn "count_zero" 61 [ (set (match_operand:SI 0 "nonimmediate_operand" "") 62 (ctz:SI (match_operand:SI 1 "general_operand" ""))) 63 (set (cc0) 64 (compare (match_dup 0) 65 (const_int 33))) 66 ] 67 "" 68 "ffs $0,$32,%1,%0") 69 70(define_expand "sync_lock_test_and_set<mode>" 71 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=&g") 72 (unspec:VAXint [(match_operand:VAXint 1 "memory_operand" "+m") 73 (match_operand:VAXint 2 "const_int_operand" "n") 74 ] VUNSPEC_LOCK))] 75 "" 76 " 77{ 78 rtx label; 79 80 if (operands[2] != const1_rtx) 81 FAIL; 82 83 label = gen_label_rtx (); 84 emit_move_insn (operands[0], const1_rtx); 85 emit_jump_insn (gen_jbbssi<mode> (operands[1], const0_rtx, label)); 86 emit_move_insn (operands[0], const0_rtx); 87 emit_label (label); 88 DONE; 89}") 90 91(define_insn "jbbssiqi" 92 [(parallel 93 [(set (pc) 94 (if_then_else 95 (ne (zero_extract:SI (match_operand:QI 0 "volatile_mem_operand" "+g") 96 (const_int 1) 97 (match_operand:SI 1 "general_operand" "nrm")) 98 (const_int 0)) 99 (label_ref (match_operand 2 "" "")) 100 (pc))) 101 (set (zero_extract:SI (match_dup 0) 102 (const_int 1) 103 (match_dup 1)) 104 (const_int 1))])] 105 "" 106 "jbssi %1,%0,%l2") 107 108(define_insn "jbbssihi" 109 [(parallel 110 [(set (pc) 111 (if_then_else 112 (ne (zero_extract:SI (match_operand:HI 0 "volatile_mem_operand" "+Q") 113 (const_int 1) 114 (match_operand:SI 1 "general_operand" "nrm")) 115 (const_int 0)) 116 (label_ref (match_operand 2 "" "")) 117 (pc))) 118 (set (zero_extract:SI (match_dup 0) 119 (const_int 1) 120 (match_dup 1)) 121 (const_int 1))])] 122 "" 123 "jbssi %1,%0,%l2") 124 125(define_insn "jbbssisi" 126 [(parallel 127 [(set (pc) 128 (if_then_else 129 (ne (zero_extract:SI (match_operand:SI 0 "volatile_mem_operand" "+Q") 130 (const_int 1) 131 (match_operand:SI 1 "general_operand" "nrm")) 132 (const_int 0)) 133 (label_ref (match_operand 2 "" "")) 134 (pc))) 135 (set (zero_extract:SI (match_dup 0) 136 (const_int 1) 137 (match_dup 1)) 138 (const_int 1))])] 139 "" 140 "jbssi %1,%0,%l2") 141 142 143(define_expand "sync_lock_release<mode>" 144 [(set (match_operand:VAXint 0 "memory_operand" "+m") 145 (unspec:VAXint [(match_operand:VAXint 1 "const_int_operand" "n") 146 ] VUNSPEC_UNLOCK))] 147 "" 148 " 149{ 150 rtx label; 151 if (operands[1] != const0_rtx) 152 FAIL; 153#if 1 154 label = gen_label_rtx (); 155 emit_jump_insn (gen_jbbcci<mode> (operands[0], const0_rtx, label, operands[0])); 156 emit_label (label); 157#else 158 emit_move_insn (operands[0], const0_rtx); 159#endif 160 DONE; 161}") 162 163(define_insn "jbbcciqi" 164 [(parallel 165 [(set (pc) 166 (if_then_else 167 (eq (zero_extract:SI (match_operand:QI 0 "memory_operand" "g") 168 (const_int 1) 169 (match_operand:SI 1 "general_operand" "nrm")) 170 (const_int 0)) 171 (label_ref (match_operand 2 "" "")) 172 (pc))) 173 (set (zero_extract:SI (match_operand:QI 3 "memory_operand" "+0") 174 (const_int 1) 175 (match_dup 1)) 176 (const_int 0))])] 177 "" 178 "jbcci %1,%0,%l2") 179 180(define_insn "jbbccihi" 181 [(parallel 182 [(set (pc) 183 (if_then_else 184 (eq (zero_extract:SI (match_operand:HI 0 "memory_operand" "Q") 185 (const_int 1) 186 (match_operand:SI 1 "general_operand" "nrm")) 187 (const_int 0)) 188 (label_ref (match_operand 2 "" "")) 189 (pc))) 190 (set (zero_extract:SI (match_operand:HI 3 "memory_operand" "+0") 191 (const_int 1) 192 (match_dup 1)) 193 (const_int 0))])] 194 "" 195 "jbcci %1,%0,%l2") 196 197(define_insn "jbbccisi" 198 [(parallel 199 [(set (pc) 200 (if_then_else 201 (eq (zero_extract:SI (match_operand:SI 0 "memory_operand" "Q") 202 (const_int 1) 203 (match_operand:SI 1 "general_operand" "nrm")) 204 (const_int 0)) 205 (label_ref (match_operand 2 "" "")) 206 (pc))) 207 (set (zero_extract:SI (match_operand:SI 3 "memory_operand" "+0") 208 (const_int 1) 209 (match_dup 1)) 210 (const_int 0))])] 211 "" 212 "jbcci %1,%0,%l2") 213