aboutsummaryrefslogtreecommitdiff
path: root/gcc/dominance.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-12-31 15:32:06 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-12-31 15:32:06 +0000
commitdc176c3ccd6a8cd3f809f3c1549ad00674061eb5 (patch)
treee3031a3fa6224b66dbc492230ee7996572dd0cbc /gcc/dominance.c
parent2c8297996a7ab3496c5d2f798cdbe4cab749468e (diff)
downloadgcc-dc176c3ccd6a8cd3f809f3c1549ad00674061eb5.zip
gcc-dc176c3ccd6a8cd3f809f3c1549ad00674061eb5.tar.gz
gcc-dc176c3ccd6a8cd3f809f3c1549ad00674061eb5.tar.bz2
Fix EXTRACT_LAST_REDUCTION segfault
This code: /* Make sure we don't accidentally use the old condition. */ cond_expr = NULL_TREE; was misplaced, since it triggered even when we needed to force the original unmodified cond_expr into a mask temporary and then invert it. 2019-12-31 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vect-stmts.c (vectorizable_condition): Only nullify cond_expr if we've created a new condition. Don't nullify it if we've decided to keep it and then invert the result. gcc/testsuite/ * gcc.dg/vect/vect-cond-reduc-6.c: New test. From-SVN: r279804
Diffstat (limited to 'gcc/dominance.c')
0 files changed, 0 insertions, 0 deletions
86'>186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
#include "encoding.h"

#define ZERO	0
#define T0      5
#define S0      8
#define S1      9

static uint32_t bits(uint32_t value, unsigned int hi, unsigned int lo)
{
	return (value >> lo) & ((1 << (hi+1-lo)) - 1);
}

static uint32_t bit(uint32_t value, unsigned int b)
{
	return (value >> b) & 1;
}

static uint32_t jal(unsigned int rd, uint32_t imm) __attribute__ ((unused));
static uint32_t jal(unsigned int rd, uint32_t imm)
{
	return (bit(imm, 20) << 31) |
		(bits(imm, 10, 1) << 21) |
		(bit(imm, 11) << 20) |
		(bits(imm, 19, 12) << 12) |
		(rd << 7) |
		MATCH_JAL;
}

static uint32_t csrsi(unsigned int csr, uint16_t imm) __attribute__ ((unused));
static uint32_t csrsi(unsigned int csr, uint16_t imm)
{
	return (csr << 20) |
		(bits(imm, 4, 0) << 15) |
		MATCH_CSRRSI;
}

static uint32_t sw(unsigned int src, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t sw(unsigned int src, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 5) << 25) |
		(src << 20) |
		(base << 15) |
		(bits(offset, 4, 0) << 7) |
		MATCH_SW;
}

static uint32_t sd(unsigned int src, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t sd(unsigned int src, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 5) << 25) |
		(src << 20) |
		(base << 15) |
		(bits(offset, 4, 0) << 7) |
		MATCH_SD;
}

static uint32_t sh(unsigned int src, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t sh(unsigned int src, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 5) << 25) |
		(src << 20) |
		(base << 15) |
		(bits(offset, 4, 0) << 7) |
		MATCH_SH;
}

static uint32_t sb(unsigned int src, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t sb(unsigned int src, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 5) << 25) |
		(src << 20) |
		(base << 15) |
		(bits(offset, 4, 0) << 7) |
		MATCH_SB;
}

static uint32_t ld(unsigned int rd, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t ld(unsigned int rd, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 0) << 20) |
		(base << 15) |
		(bits(rd, 4, 0) << 7) |
		MATCH_LD;
}

static uint32_t lw(unsigned int rd, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t lw(unsigned int rd, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 0) << 20) |
		(base << 15) |
		(bits(rd, 4, 0) << 7) |
		MATCH_LW;
}

static uint32_t lh(unsigned int rd, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t lh(unsigned int rd, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 0) << 20) |
		(base << 15) |
		(bits(rd, 4, 0) << 7) |
		MATCH_LH;
}

static uint32_t lb(unsigned int rd, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t lb(unsigned int rd, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 0) << 20) |
		(base << 15) |
		(bits(rd, 4, 0) << 7) |
		MATCH_LB;
}

static uint32_t csrw(unsigned int source, unsigned int csr) __attribute__ ((unused));
static uint32_t csrw(unsigned int source, unsigned int csr)
{
	return (csr << 20) | (source << 15) | MATCH_CSRRW;
}

static uint32_t addi(unsigned int dest, unsigned int src, uint16_t imm) __attribute__ ((unused));
static uint32_t addi(unsigned int dest, unsigned int src, uint16_t imm)
{
	return (bits(imm, 11, 0) << 20) |
		(src << 15) |
		(dest << 7) |
		MATCH_ADDI;
}

static uint32_t csrr(unsigned int rd, unsigned int csr) __attribute__ ((unused));
static uint32_t csrr(unsigned int rd, unsigned int csr)
{
	return (csr << 20) | (rd << 7) | MATCH_CSRRS;
}

static uint32_t csrrs(unsigned int rd, unsigned int rs, unsigned int csr) __attribute__ ((unused));
static uint32_t csrrs(unsigned int rd, unsigned int rs, unsigned int csr)
{
	return (csr << 20) | (rs << 15) | (rd << 7) | MATCH_CSRRS;
}

static uint32_t csrrw(unsigned int rd, unsigned int rs, unsigned int csr) __attribute__ ((unused));
static uint32_t csrrw(unsigned int rd, unsigned int rs, unsigned int csr)
{
	return (csr << 20) | (rs << 15) | (rd << 7) | MATCH_CSRRW;
}

static uint32_t csrrci(unsigned int rd, unsigned int zimm, unsigned int csr) __attribute__ ((unused));
static uint32_t csrrci(unsigned int rd, unsigned int zimm, unsigned int csr)
{
	return (csr << 20) | (zimm << 15) | (rd << 7) | MATCH_CSRRCI;
}

static uint32_t csrrsi(unsigned int rd, unsigned int zimm, unsigned int csr) __attribute__ ((unused));
static uint32_t csrrsi(unsigned int rd, unsigned int zimm, unsigned int csr)
{
	return (csr << 20) | (zimm << 15) | (rd << 7) | MATCH_CSRRSI;
}

static uint32_t fsw(unsigned int src, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t fsw(unsigned int src, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 5) << 25) |
		(bits(src, 4, 0) << 20) |
		(base << 15) |
		(bits(offset, 4, 0) << 7) |
		MATCH_FSW;
}

static uint32_t fsd(unsigned int src, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t fsd(unsigned int src, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 5) << 25) |
		(bits(src, 4, 0) << 20) |
		(base << 15) |
		(bits(offset, 4, 0) << 7) |
		MATCH_FSD;
}

static uint32_t flw(unsigned int dest, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t flw(unsigned int dest, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 0) << 20) |
		(base << 15) |
		(bits(dest, 4, 0) << 7) |
		MATCH_FLW;
}

static uint32_t fld(unsigned int dest, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t fld(unsigned int dest, unsigned int base, uint16_t offset)
{
	return (bits(offset, 11, 0) << 20) |
		(base << 15) |
		(bits(dest, 4, 0) << 7) |
		MATCH_FLD;
}

static uint32_t fmv_x_w(unsigned dest, unsigned src) __attribute__ ((unused));
static uint32_t fmv_x_w(unsigned dest, unsigned src)
{
	return src << 15 |
		dest << 7 |
		MATCH_FMV_X_W;
}

static uint32_t fmv_x_d(unsigned dest, unsigned src) __attribute__ ((unused));
static uint32_t fmv_x_d(unsigned dest, unsigned src)
{
	return src << 15 |
		dest << 7 |
		MATCH_FMV_X_D;
}

static uint32_t fmv_w_x(unsigned dest, unsigned src) __attribute__ ((unused));
static uint32_t fmv_w_x(unsigned dest, unsigned src)
{
	return src << 15 |
		dest << 7 |
		MATCH_FMV_W_X;
}

static uint32_t fmv_d_x(unsigned dest, unsigned src) __attribute__ ((unused));
static uint32_t fmv_d_x(unsigned dest, unsigned src)
{
	return src << 15 |
		dest << 7 |
		MATCH_FMV_D_X;
}

static uint32_t ebreak(void) __attribute__ ((unused));
static uint32_t ebreak(void)
{
	return MATCH_EBREAK;
}
static uint32_t ebreak_c(void) __attribute__ ((unused));
static uint32_t ebreak_c(void)
{
	return MATCH_C_EBREAK;
}

static uint32_t wfi(void) __attribute__ ((unused));
static uint32_t wfi(void) { return MATCH_WFI; }

static uint32_t fence_i(void) __attribute__ ((unused));
static uint32_t fence_i(void)
{
	return MATCH_FENCE_I;
}

static uint32_t lui(unsigned int dest, uint32_t imm) __attribute__ ((unused));
static uint32_t lui(unsigned int dest, uint32_t imm)
{
	return (bits(imm, 19, 0) << 12) |
		(dest << 7) |
		MATCH_LUI;
}

/*
static uint32_t csrci(unsigned int csr, uint16_t imm) __attribute__ ((unused));
static uint32_t csrci(unsigned int csr, uint16_t imm)
{
  return (csr << 20) |
    (bits(imm, 4, 0) << 15) |
    MATCH_CSRRCI;
}

static uint32_t li(unsigned int dest, uint16_t imm) __attribute__ ((unused));
static uint32_t li(unsigned int dest, uint16_t imm)
{
	return addi(dest, 0, imm);
}

static uint32_t fsd(unsigned int src, unsigned int base, uint16_t offset) __attribute__ ((unused));
static uint32_t fsd(unsigned int src, unsigned int base, uint16_t offset)
{
  return (bits(offset, 11, 5) << 25) |
    (bits(src, 4, 0) << 20) |
    (base << 15) |
    (bits(offset, 4, 0) << 7) |
    MATCH_FSD;
}

static uint32_t ori(unsigned int dest, unsigned int src, uint16_t imm) __attribute__ ((unused));
static uint32_t ori(unsigned int dest, unsigned int src, uint16_t imm)
{
  return (bits(imm, 11, 0) << 20) |
    (src << 15) |
    (dest << 7) |
    MATCH_ORI;
}

static uint32_t nop(void) __attribute__ ((unused));
static uint32_t nop(void)
{
  return addi(0, 0, 0);
}
*/

static uint32_t xori(unsigned int dest, unsigned int src, uint16_t imm) __attribute__ ((unused));
static uint32_t xori(unsigned int dest, unsigned int src, uint16_t imm)
{
	return (bits(imm, 11, 0) << 20) |
		(src << 15) |
		(dest << 7) |
		MATCH_XORI;
}

static uint32_t srli(unsigned int dest, unsigned int src, uint8_t shamt) __attribute__ ((unused));
static uint32_t srli(unsigned int dest, unsigned int src, uint8_t shamt)
{
	return (bits(shamt, 4, 0) << 20) |
		(src << 15) |
		(dest << 7) |
		MATCH_SRLI;
}

static uint32_t fence(void) __attribute__((unused));
static uint32_t fence(void)
{
	return MATCH_FENCE;
}

static uint32_t auipc(unsigned int dest) __attribute__((unused));
static uint32_t auipc(unsigned int dest)
{
	return MATCH_AUIPC | (dest << 7);
}

static uint32_t vsetvli(unsigned int dest, unsigned int src, uint16_t imm) __attribute__((unused));
static uint32_t vsetvli(unsigned int dest, unsigned int src, uint16_t imm)
{
	return (bits(imm, 10, 0) << 20) |
		(src << 15) |
		(dest << 7) |
		MATCH_VSETVLI;
}

static uint32_t vmv_x_s(unsigned int rd, unsigned int vs2) __attribute__((unused));
static uint32_t vmv_x_s(unsigned int rd, unsigned int vs2)
{
	return (vs2 << 20) | (rd << 7) | MATCH_VMV_X_S;
}

static uint32_t vmv_s_x(unsigned int vd, unsigned int vs2) __attribute__((unused));
static uint32_t vmv_s_x(unsigned int vd, unsigned int rs1)
{
	return (rs1 << 15) | (vd << 7) | MATCH_VMV_S_X;
}

static uint32_t vslide1down_vx(unsigned int vd, unsigned int vs2,
		unsigned int rs1, unsigned int vm) __attribute__((unused));
static uint32_t vslide1down_vx(unsigned int vd, unsigned int vs2,