1 package gc 2 3 import "testing" 4 5 func TestConstFolduint64add(t *testing.T) { 6 var x, y, r uint64 7 x = 0 8 y = 0 9 r = x + y 10 if r != 0 { 11 t.Errorf("0 %s 0 = %d, want 0", "+", r) 12 } 13 y = 1 14 r = x + y 15 if r != 1 { 16 t.Errorf("0 %s 1 = %d, want 1", "+", r) 17 } 18 y = 4294967296 19 r = x + y 20 if r != 4294967296 { 21 t.Errorf("0 %s 4294967296 = %d, want 4294967296", "+", r) 22 } 23 y = 18446744073709551615 24 r = x + y 25 if r != 18446744073709551615 { 26 t.Errorf("0 %s 18446744073709551615 = %d, want 18446744073709551615", "+", r) 27 } 28 x = 1 29 y = 0 30 r = x + y 31 if r != 1 { 32 t.Errorf("1 %s 0 = %d, want 1", "+", r) 33 } 34 y = 1 35 r = x + y 36 if r != 2 { 37 t.Errorf("1 %s 1 = %d, want 2", "+", r) 38 } 39 y = 4294967296 40 r = x + y 41 if r != 4294967297 { 42 t.Errorf("1 %s 4294967296 = %d, want 4294967297", "+", r) 43 } 44 y = 18446744073709551615 45 r = x + y 46 if r != 0 { 47 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "+", r) 48 } 49 x = 4294967296 50 y = 0 51 r = x + y 52 if r != 4294967296 { 53 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "+", r) 54 } 55 y = 1 56 r = x + y 57 if r != 4294967297 { 58 t.Errorf("4294967296 %s 1 = %d, want 4294967297", "+", r) 59 } 60 y = 4294967296 61 r = x + y 62 if r != 8589934592 { 63 t.Errorf("4294967296 %s 4294967296 = %d, want 8589934592", "+", r) 64 } 65 y = 18446744073709551615 66 r = x + y 67 if r != 4294967295 { 68 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 4294967295", "+", r) 69 } 70 x = 18446744073709551615 71 y = 0 72 r = x + y 73 if r != 18446744073709551615 { 74 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "+", r) 75 } 76 y = 1 77 r = x + y 78 if r != 0 { 79 t.Errorf("18446744073709551615 %s 1 = %d, want 0", "+", r) 80 } 81 y = 4294967296 82 r = x + y 83 if r != 4294967295 { 84 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 4294967295", "+", r) 85 } 86 y = 18446744073709551615 87 r = x + y 88 if r != 18446744073709551614 { 89 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 18446744073709551614", "+", r) 90 } 91 } 92 func TestConstFolduint64sub(t *testing.T) { 93 var x, y, r uint64 94 x = 0 95 y = 0 96 r = x - y 97 if r != 0 { 98 t.Errorf("0 %s 0 = %d, want 0", "-", r) 99 } 100 y = 1 101 r = x - y 102 if r != 18446744073709551615 { 103 t.Errorf("0 %s 1 = %d, want 18446744073709551615", "-", r) 104 } 105 y = 4294967296 106 r = x - y 107 if r != 18446744069414584320 { 108 t.Errorf("0 %s 4294967296 = %d, want 18446744069414584320", "-", r) 109 } 110 y = 18446744073709551615 111 r = x - y 112 if r != 1 { 113 t.Errorf("0 %s 18446744073709551615 = %d, want 1", "-", r) 114 } 115 x = 1 116 y = 0 117 r = x - y 118 if r != 1 { 119 t.Errorf("1 %s 0 = %d, want 1", "-", r) 120 } 121 y = 1 122 r = x - y 123 if r != 0 { 124 t.Errorf("1 %s 1 = %d, want 0", "-", r) 125 } 126 y = 4294967296 127 r = x - y 128 if r != 18446744069414584321 { 129 t.Errorf("1 %s 4294967296 = %d, want 18446744069414584321", "-", r) 130 } 131 y = 18446744073709551615 132 r = x - y 133 if r != 2 { 134 t.Errorf("1 %s 18446744073709551615 = %d, want 2", "-", r) 135 } 136 x = 4294967296 137 y = 0 138 r = x - y 139 if r != 4294967296 { 140 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "-", r) 141 } 142 y = 1 143 r = x - y 144 if r != 4294967295 { 145 t.Errorf("4294967296 %s 1 = %d, want 4294967295", "-", r) 146 } 147 y = 4294967296 148 r = x - y 149 if r != 0 { 150 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "-", r) 151 } 152 y = 18446744073709551615 153 r = x - y 154 if r != 4294967297 { 155 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 4294967297", "-", r) 156 } 157 x = 18446744073709551615 158 y = 0 159 r = x - y 160 if r != 18446744073709551615 { 161 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "-", r) 162 } 163 y = 1 164 r = x - y 165 if r != 18446744073709551614 { 166 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "-", r) 167 } 168 y = 4294967296 169 r = x - y 170 if r != 18446744069414584319 { 171 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 18446744069414584319", "-", r) 172 } 173 y = 18446744073709551615 174 r = x - y 175 if r != 0 { 176 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 0", "-", r) 177 } 178 } 179 func TestConstFolduint64div(t *testing.T) { 180 var x, y, r uint64 181 x = 0 182 y = 1 183 r = x / y 184 if r != 0 { 185 t.Errorf("0 %s 1 = %d, want 0", "/", r) 186 } 187 y = 4294967296 188 r = x / y 189 if r != 0 { 190 t.Errorf("0 %s 4294967296 = %d, want 0", "/", r) 191 } 192 y = 18446744073709551615 193 r = x / y 194 if r != 0 { 195 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "/", r) 196 } 197 x = 1 198 y = 1 199 r = x / y 200 if r != 1 { 201 t.Errorf("1 %s 1 = %d, want 1", "/", r) 202 } 203 y = 4294967296 204 r = x / y 205 if r != 0 { 206 t.Errorf("1 %s 4294967296 = %d, want 0", "/", r) 207 } 208 y = 18446744073709551615 209 r = x / y 210 if r != 0 { 211 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "/", r) 212 } 213 x = 4294967296 214 y = 1 215 r = x / y 216 if r != 4294967296 { 217 t.Errorf("4294967296 %s 1 = %d, want 4294967296", "/", r) 218 } 219 y = 4294967296 220 r = x / y 221 if r != 1 { 222 t.Errorf("4294967296 %s 4294967296 = %d, want 1", "/", r) 223 } 224 y = 18446744073709551615 225 r = x / y 226 if r != 0 { 227 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", "/", r) 228 } 229 x = 18446744073709551615 230 y = 1 231 r = x / y 232 if r != 18446744073709551615 { 233 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551615", "/", r) 234 } 235 y = 4294967296 236 r = x / y 237 if r != 4294967295 { 238 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 4294967295", "/", r) 239 } 240 y = 18446744073709551615 241 r = x / y 242 if r != 1 { 243 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 1", "/", r) 244 } 245 } 246 func TestConstFolduint64mul(t *testing.T) { 247 var x, y, r uint64 248 x = 0 249 y = 0 250 r = x * y 251 if r != 0 { 252 t.Errorf("0 %s 0 = %d, want 0", "*", r) 253 } 254 y = 1 255 r = x * y 256 if r != 0 { 257 t.Errorf("0 %s 1 = %d, want 0", "*", r) 258 } 259 y = 4294967296 260 r = x * y 261 if r != 0 { 262 t.Errorf("0 %s 4294967296 = %d, want 0", "*", r) 263 } 264 y = 18446744073709551615 265 r = x * y 266 if r != 0 { 267 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "*", r) 268 } 269 x = 1 270 y = 0 271 r = x * y 272 if r != 0 { 273 t.Errorf("1 %s 0 = %d, want 0", "*", r) 274 } 275 y = 1 276 r = x * y 277 if r != 1 { 278 t.Errorf("1 %s 1 = %d, want 1", "*", r) 279 } 280 y = 4294967296 281 r = x * y 282 if r != 4294967296 { 283 t.Errorf("1 %s 4294967296 = %d, want 4294967296", "*", r) 284 } 285 y = 18446744073709551615 286 r = x * y 287 if r != 18446744073709551615 { 288 t.Errorf("1 %s 18446744073709551615 = %d, want 18446744073709551615", "*", r) 289 } 290 x = 4294967296 291 y = 0 292 r = x * y 293 if r != 0 { 294 t.Errorf("4294967296 %s 0 = %d, want 0", "*", r) 295 } 296 y = 1 297 r = x * y 298 if r != 4294967296 { 299 t.Errorf("4294967296 %s 1 = %d, want 4294967296", "*", r) 300 } 301 y = 4294967296 302 r = x * y 303 if r != 0 { 304 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "*", r) 305 } 306 y = 18446744073709551615 307 r = x * y 308 if r != 18446744069414584320 { 309 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 18446744069414584320", "*", r) 310 } 311 x = 18446744073709551615 312 y = 0 313 r = x * y 314 if r != 0 { 315 t.Errorf("18446744073709551615 %s 0 = %d, want 0", "*", r) 316 } 317 y = 1 318 r = x * y 319 if r != 18446744073709551615 { 320 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551615", "*", r) 321 } 322 y = 4294967296 323 r = x * y 324 if r != 18446744069414584320 { 325 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 18446744069414584320", "*", r) 326 } 327 y = 18446744073709551615 328 r = x * y 329 if r != 1 { 330 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 1", "*", r) 331 } 332 } 333 func TestConstFolduint64mod(t *testing.T) { 334 var x, y, r uint64 335 x = 0 336 y = 1 337 r = x % y 338 if r != 0 { 339 t.Errorf("0 %s 1 = %d, want 0", "%", r) 340 } 341 y = 4294967296 342 r = x % y 343 if r != 0 { 344 t.Errorf("0 %s 4294967296 = %d, want 0", "%", r) 345 } 346 y = 18446744073709551615 347 r = x % y 348 if r != 0 { 349 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "%", r) 350 } 351 x = 1 352 y = 1 353 r = x % y 354 if r != 0 { 355 t.Errorf("1 %s 1 = %d, want 0", "%", r) 356 } 357 y = 4294967296 358 r = x % y 359 if r != 1 { 360 t.Errorf("1 %s 4294967296 = %d, want 1", "%", r) 361 } 362 y = 18446744073709551615 363 r = x % y 364 if r != 1 { 365 t.Errorf("1 %s 18446744073709551615 = %d, want 1", "%", r) 366 } 367 x = 4294967296 368 y = 1 369 r = x % y 370 if r != 0 { 371 t.Errorf("4294967296 %s 1 = %d, want 0", "%", r) 372 } 373 y = 4294967296 374 r = x % y 375 if r != 0 { 376 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "%", r) 377 } 378 y = 18446744073709551615 379 r = x % y 380 if r != 4294967296 { 381 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 4294967296", "%", r) 382 } 383 x = 18446744073709551615 384 y = 1 385 r = x % y 386 if r != 0 { 387 t.Errorf("18446744073709551615 %s 1 = %d, want 0", "%", r) 388 } 389 y = 4294967296 390 r = x % y 391 if r != 4294967295 { 392 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 4294967295", "%", r) 393 } 394 y = 18446744073709551615 395 r = x % y 396 if r != 0 { 397 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 0", "%", r) 398 } 399 } 400 func TestConstFoldint64add(t *testing.T) { 401 var x, y, r int64 402 x = -9223372036854775808 403 y = -9223372036854775808 404 r = x + y 405 if r != 0 { 406 t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "+", r) 407 } 408 y = -9223372036854775807 409 r = x + y 410 if r != 1 { 411 t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want 1", "+", r) 412 } 413 y = -4294967296 414 r = x + y 415 if r != 9223372032559808512 { 416 t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 9223372032559808512", "+", r) 417 } 418 y = -1 419 r = x + y 420 if r != 9223372036854775807 { 421 t.Errorf("-9223372036854775808 %s -1 = %d, want 9223372036854775807", "+", r) 422 } 423 y = 0 424 r = x + y 425 if r != -9223372036854775808 { 426 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "+", r) 427 } 428 y = 1 429 r = x + y 430 if r != -9223372036854775807 { 431 t.Errorf("-9223372036854775808 %s 1 = %d, want -9223372036854775807", "+", r) 432 } 433 y = 4294967296 434 r = x + y 435 if r != -9223372032559808512 { 436 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want -9223372032559808512", "+", r) 437 } 438 y = 9223372036854775806 439 r = x + y 440 if r != -2 { 441 t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want -2", "+", r) 442 } 443 y = 9223372036854775807 444 r = x + y 445 if r != -1 { 446 t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -1", "+", r) 447 } 448 x = -9223372036854775807 449 y = -9223372036854775808 450 r = x + y 451 if r != 1 { 452 t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want 1", "+", r) 453 } 454 y = -9223372036854775807 455 r = x + y 456 if r != 2 { 457 t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 2", "+", r) 458 } 459 y = -4294967296 460 r = x + y 461 if r != 9223372032559808513 { 462 t.Errorf("-9223372036854775807 %s -4294967296 = %d, want 9223372032559808513", "+", r) 463 } 464 y = -1 465 r = x + y 466 if r != -9223372036854775808 { 467 t.Errorf("-9223372036854775807 %s -1 = %d, want -9223372036854775808", "+", r) 468 } 469 y = 0 470 r = x + y 471 if r != -9223372036854775807 { 472 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "+", r) 473 } 474 y = 1 475 r = x + y 476 if r != -9223372036854775806 { 477 t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775806", "+", r) 478 } 479 y = 4294967296 480 r = x + y 481 if r != -9223372032559808511 { 482 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -9223372032559808511", "+", r) 483 } 484 y = 9223372036854775806 485 r = x + y 486 if r != -1 { 487 t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want -1", "+", r) 488 } 489 y = 9223372036854775807 490 r = x + y 491 if r != 0 { 492 t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want 0", "+", r) 493 } 494 x = -4294967296 495 y = -9223372036854775808 496 r = x + y 497 if r != 9223372032559808512 { 498 t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 9223372032559808512", "+", r) 499 } 500 y = -9223372036854775807 501 r = x + y 502 if r != 9223372032559808513 { 503 t.Errorf("-4294967296 %s -9223372036854775807 = %d, want 9223372032559808513", "+", r) 504 } 505 y = -4294967296 506 r = x + y 507 if r != -8589934592 { 508 t.Errorf("-4294967296 %s -4294967296 = %d, want -8589934592", "+", r) 509 } 510 y = -1 511 r = x + y 512 if r != -4294967297 { 513 t.Errorf("-4294967296 %s -1 = %d, want -4294967297", "+", r) 514 } 515 y = 0 516 r = x + y 517 if r != -4294967296 { 518 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "+", r) 519 } 520 y = 1 521 r = x + y 522 if r != -4294967295 { 523 t.Errorf("-4294967296 %s 1 = %d, want -4294967295", "+", r) 524 } 525 y = 4294967296 526 r = x + y 527 if r != 0 { 528 t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "+", r) 529 } 530 y = 9223372036854775806 531 r = x + y 532 if r != 9223372032559808510 { 533 t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 9223372032559808510", "+", r) 534 } 535 y = 9223372036854775807 536 r = x + y 537 if r != 9223372032559808511 { 538 t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 9223372032559808511", "+", r) 539 } 540 x = -1 541 y = -9223372036854775808 542 r = x + y 543 if r != 9223372036854775807 { 544 t.Errorf("-1 %s -9223372036854775808 = %d, want 9223372036854775807", "+", r) 545 } 546 y = -9223372036854775807 547 r = x + y 548 if r != -9223372036854775808 { 549 t.Errorf("-1 %s -9223372036854775807 = %d, want -9223372036854775808", "+", r) 550 } 551 y = -4294967296 552 r = x + y 553 if r != -4294967297 { 554 t.Errorf("-1 %s -4294967296 = %d, want -4294967297", "+", r) 555 } 556 y = -1 557 r = x + y 558 if r != -2 { 559 t.Errorf("-1 %s -1 = %d, want -2", "+", r) 560 } 561 y = 0 562 r = x + y 563 if r != -1 { 564 t.Errorf("-1 %s 0 = %d, want -1", "+", r) 565 } 566 y = 1 567 r = x + y 568 if r != 0 { 569 t.Errorf("-1 %s 1 = %d, want 0", "+", r) 570 } 571 y = 4294967296 572 r = x + y 573 if r != 4294967295 { 574 t.Errorf("-1 %s 4294967296 = %d, want 4294967295", "+", r) 575 } 576 y = 9223372036854775806 577 r = x + y 578 if r != 9223372036854775805 { 579 t.Errorf("-1 %s 9223372036854775806 = %d, want 9223372036854775805", "+", r) 580 } 581 y = 9223372036854775807 582 r = x + y 583 if r != 9223372036854775806 { 584 t.Errorf("-1 %s 9223372036854775807 = %d, want 9223372036854775806", "+", r) 585 } 586 x = 0 587 y = -9223372036854775808 588 r = x + y 589 if r != -9223372036854775808 { 590 t.Errorf("0 %s -9223372036854775808 = %d, want -9223372036854775808", "+", r) 591 } 592 y = -9223372036854775807 593 r = x + y 594 if r != -9223372036854775807 { 595 t.Errorf("0 %s -9223372036854775807 = %d, want -9223372036854775807", "+", r) 596 } 597 y = -4294967296 598 r = x + y 599 if r != -4294967296 { 600 t.Errorf("0 %s -4294967296 = %d, want -4294967296", "+", r) 601 } 602 y = -1 603 r = x + y 604 if r != -1 { 605 t.Errorf("0 %s -1 = %d, want -1", "+", r) 606 } 607 y = 0 608 r = x + y 609 if r != 0 { 610 t.Errorf("0 %s 0 = %d, want 0", "+", r) 611 } 612 y = 1 613 r = x + y 614 if r != 1 { 615 t.Errorf("0 %s 1 = %d, want 1", "+", r) 616 } 617 y = 4294967296 618 r = x + y 619 if r != 4294967296 { 620 t.Errorf("0 %s 4294967296 = %d, want 4294967296", "+", r) 621 } 622 y = 9223372036854775806 623 r = x + y 624 if r != 9223372036854775806 { 625 t.Errorf("0 %s 9223372036854775806 = %d, want 9223372036854775806", "+", r) 626 } 627 y = 9223372036854775807 628 r = x + y 629 if r != 9223372036854775807 { 630 t.Errorf("0 %s 9223372036854775807 = %d, want 9223372036854775807", "+", r) 631 } 632 x = 1 633 y = -9223372036854775808 634 r = x + y 635 if r != -9223372036854775807 { 636 t.Errorf("1 %s -9223372036854775808 = %d, want -9223372036854775807", "+", r) 637 } 638 y = -9223372036854775807 639 r = x + y 640 if r != -9223372036854775806 { 641 t.Errorf("1 %s -9223372036854775807 = %d, want -9223372036854775806", "+", r) 642 } 643 y = -4294967296 644 r = x + y 645 if r != -4294967295 { 646 t.Errorf("1 %s -4294967296 = %d, want -4294967295", "+", r) 647 } 648 y = -1 649 r = x + y 650 if r != 0 { 651 t.Errorf("1 %s -1 = %d, want 0", "+", r) 652 } 653 y = 0 654 r = x + y 655 if r != 1 { 656 t.Errorf("1 %s 0 = %d, want 1", "+", r) 657 } 658 y = 1 659 r = x + y 660 if r != 2 { 661 t.Errorf("1 %s 1 = %d, want 2", "+", r) 662 } 663 y = 4294967296 664 r = x + y 665 if r != 4294967297 { 666 t.Errorf("1 %s 4294967296 = %d, want 4294967297", "+", r) 667 } 668 y = 9223372036854775806 669 r = x + y 670 if r != 9223372036854775807 { 671 t.Errorf("1 %s 9223372036854775806 = %d, want 9223372036854775807", "+", r) 672 } 673 y = 9223372036854775807 674 r = x + y 675 if r != -9223372036854775808 { 676 t.Errorf("1 %s 9223372036854775807 = %d, want -9223372036854775808", "+", r) 677 } 678 x = 4294967296 679 y = -9223372036854775808 680 r = x + y 681 if r != -9223372032559808512 { 682 t.Errorf("4294967296 %s -9223372036854775808 = %d, want -9223372032559808512", "+", r) 683 } 684 y = -9223372036854775807 685 r = x + y 686 if r != -9223372032559808511 { 687 t.Errorf("4294967296 %s -9223372036854775807 = %d, want -9223372032559808511", "+", r) 688 } 689 y = -4294967296 690 r = x + y 691 if r != 0 { 692 t.Errorf("4294967296 %s -4294967296 = %d, want 0", "+", r) 693 } 694 y = -1 695 r = x + y 696 if r != 4294967295 { 697 t.Errorf("4294967296 %s -1 = %d, want 4294967295", "+", r) 698 } 699 y = 0 700 r = x + y 701 if r != 4294967296 { 702 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "+", r) 703 } 704 y = 1 705 r = x + y 706 if r != 4294967297 { 707 t.Errorf("4294967296 %s 1 = %d, want 4294967297", "+", r) 708 } 709 y = 4294967296 710 r = x + y 711 if r != 8589934592 { 712 t.Errorf("4294967296 %s 4294967296 = %d, want 8589934592", "+", r) 713 } 714 y = 9223372036854775806 715 r = x + y 716 if r != -9223372032559808514 { 717 t.Errorf("4294967296 %s 9223372036854775806 = %d, want -9223372032559808514", "+", r) 718 } 719 y = 9223372036854775807 720 r = x + y 721 if r != -9223372032559808513 { 722 t.Errorf("4294967296 %s 9223372036854775807 = %d, want -9223372032559808513", "+", r) 723 } 724 x = 9223372036854775806 725 y = -9223372036854775808 726 r = x + y 727 if r != -2 { 728 t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want -2", "+", r) 729 } 730 y = -9223372036854775807 731 r = x + y 732 if r != -1 { 733 t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want -1", "+", r) 734 } 735 y = -4294967296 736 r = x + y 737 if r != 9223372032559808510 { 738 t.Errorf("9223372036854775806 %s -4294967296 = %d, want 9223372032559808510", "+", r) 739 } 740 y = -1 741 r = x + y 742 if r != 9223372036854775805 { 743 t.Errorf("9223372036854775806 %s -1 = %d, want 9223372036854775805", "+", r) 744 } 745 y = 0 746 r = x + y 747 if r != 9223372036854775806 { 748 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "+", r) 749 } 750 y = 1 751 r = x + y 752 if r != 9223372036854775807 { 753 t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775807", "+", r) 754 } 755 y = 4294967296 756 r = x + y 757 if r != -9223372032559808514 { 758 t.Errorf("9223372036854775806 %s 4294967296 = %d, want -9223372032559808514", "+", r) 759 } 760 y = 9223372036854775806 761 r = x + y 762 if r != -4 { 763 t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want -4", "+", r) 764 } 765 y = 9223372036854775807 766 r = x + y 767 if r != -3 { 768 t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want -3", "+", r) 769 } 770 x = 9223372036854775807 771 y = -9223372036854775808 772 r = x + y 773 if r != -1 { 774 t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want -1", "+", r) 775 } 776 y = -9223372036854775807 777 r = x + y 778 if r != 0 { 779 t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want 0", "+", r) 780 } 781 y = -4294967296 782 r = x + y 783 if r != 9223372032559808511 { 784 t.Errorf("9223372036854775807 %s -4294967296 = %d, want 9223372032559808511", "+", r) 785 } 786 y = -1 787 r = x + y 788 if r != 9223372036854775806 { 789 t.Errorf("9223372036854775807 %s -1 = %d, want 9223372036854775806", "+", r) 790 } 791 y = 0 792 r = x + y 793 if r != 9223372036854775807 { 794 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "+", r) 795 } 796 y = 1 797 r = x + y 798 if r != -9223372036854775808 { 799 t.Errorf("9223372036854775807 %s 1 = %d, want -9223372036854775808", "+", r) 800 } 801 y = 4294967296 802 r = x + y 803 if r != -9223372032559808513 { 804 t.Errorf("9223372036854775807 %s 4294967296 = %d, want -9223372032559808513", "+", r) 805 } 806 y = 9223372036854775806 807 r = x + y 808 if r != -3 { 809 t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want -3", "+", r) 810 } 811 y = 9223372036854775807 812 r = x + y 813 if r != -2 { 814 t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want -2", "+", r) 815 } 816 } 817 func TestConstFoldint64sub(t *testing.T) { 818 var x, y, r int64 819 x = -9223372036854775808 820 y = -9223372036854775808 821 r = x - y 822 if r != 0 { 823 t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "-", r) 824 } 825 y = -9223372036854775807 826 r = x - y 827 if r != -1 { 828 t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want -1", "-", r) 829 } 830 y = -4294967296 831 r = x - y 832 if r != -9223372032559808512 { 833 t.Errorf("-9223372036854775808 %s -4294967296 = %d, want -9223372032559808512", "-", r) 834 } 835 y = -1 836 r = x - y 837 if r != -9223372036854775807 { 838 t.Errorf("-9223372036854775808 %s -1 = %d, want -9223372036854775807", "-", r) 839 } 840 y = 0 841 r = x - y 842 if r != -9223372036854775808 { 843 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "-", r) 844 } 845 y = 1 846 r = x - y 847 if r != 9223372036854775807 { 848 t.Errorf("-9223372036854775808 %s 1 = %d, want 9223372036854775807", "-", r) 849 } 850 y = 4294967296 851 r = x - y 852 if r != 9223372032559808512 { 853 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 9223372032559808512", "-", r) 854 } 855 y = 9223372036854775806 856 r = x - y 857 if r != 2 { 858 t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want 2", "-", r) 859 } 860 y = 9223372036854775807 861 r = x - y 862 if r != 1 { 863 t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want 1", "-", r) 864 } 865 x = -9223372036854775807 866 y = -9223372036854775808 867 r = x - y 868 if r != 1 { 869 t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want 1", "-", r) 870 } 871 y = -9223372036854775807 872 r = x - y 873 if r != 0 { 874 t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 0", "-", r) 875 } 876 y = -4294967296 877 r = x - y 878 if r != -9223372032559808511 { 879 t.Errorf("-9223372036854775807 %s -4294967296 = %d, want -9223372032559808511", "-", r) 880 } 881 y = -1 882 r = x - y 883 if r != -9223372036854775806 { 884 t.Errorf("-9223372036854775807 %s -1 = %d, want -9223372036854775806", "-", r) 885 } 886 y = 0 887 r = x - y 888 if r != -9223372036854775807 { 889 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "-", r) 890 } 891 y = 1 892 r = x - y 893 if r != -9223372036854775808 { 894 t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775808", "-", r) 895 } 896 y = 4294967296 897 r = x - y 898 if r != 9223372032559808513 { 899 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want 9223372032559808513", "-", r) 900 } 901 y = 9223372036854775806 902 r = x - y 903 if r != 3 { 904 t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want 3", "-", r) 905 } 906 y = 9223372036854775807 907 r = x - y 908 if r != 2 { 909 t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want 2", "-", r) 910 } 911 x = -4294967296 912 y = -9223372036854775808 913 r = x - y 914 if r != 9223372032559808512 { 915 t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 9223372032559808512", "-", r) 916 } 917 y = -9223372036854775807 918 r = x - y 919 if r != 9223372032559808511 { 920 t.Errorf("-4294967296 %s -9223372036854775807 = %d, want 9223372032559808511", "-", r) 921 } 922 y = -4294967296 923 r = x - y 924 if r != 0 { 925 t.Errorf("-4294967296 %s -4294967296 = %d, want 0", "-", r) 926 } 927 y = -1 928 r = x - y 929 if r != -4294967295 { 930 t.Errorf("-4294967296 %s -1 = %d, want -4294967295", "-", r) 931 } 932 y = 0 933 r = x - y 934 if r != -4294967296 { 935 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "-", r) 936 } 937 y = 1 938 r = x - y 939 if r != -4294967297 { 940 t.Errorf("-4294967296 %s 1 = %d, want -4294967297", "-", r) 941 } 942 y = 4294967296 943 r = x - y 944 if r != -8589934592 { 945 t.Errorf("-4294967296 %s 4294967296 = %d, want -8589934592", "-", r) 946 } 947 y = 9223372036854775806 948 r = x - y 949 if r != 9223372032559808514 { 950 t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 9223372032559808514", "-", r) 951 } 952 y = 9223372036854775807 953 r = x - y 954 if r != 9223372032559808513 { 955 t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 9223372032559808513", "-", r) 956 } 957 x = -1 958 y = -9223372036854775808 959 r = x - y 960 if r != 9223372036854775807 { 961 t.Errorf("-1 %s -9223372036854775808 = %d, want 9223372036854775807", "-", r) 962 } 963 y = -9223372036854775807 964 r = x - y 965 if r != 9223372036854775806 { 966 t.Errorf("-1 %s -9223372036854775807 = %d, want 9223372036854775806", "-", r) 967 } 968 y = -4294967296 969 r = x - y 970 if r != 4294967295 { 971 t.Errorf("-1 %s -4294967296 = %d, want 4294967295", "-", r) 972 } 973 y = -1 974 r = x - y 975 if r != 0 { 976 t.Errorf("-1 %s -1 = %d, want 0", "-", r) 977 } 978 y = 0 979 r = x - y 980 if r != -1 { 981 t.Errorf("-1 %s 0 = %d, want -1", "-", r) 982 } 983 y = 1 984 r = x - y 985 if r != -2 { 986 t.Errorf("-1 %s 1 = %d, want -2", "-", r) 987 } 988 y = 4294967296 989 r = x - y 990 if r != -4294967297 { 991 t.Errorf("-1 %s 4294967296 = %d, want -4294967297", "-", r) 992 } 993 y = 9223372036854775806 994 r = x - y 995 if r != -9223372036854775807 { 996 t.Errorf("-1 %s 9223372036854775806 = %d, want -9223372036854775807", "-", r) 997 } 998 y = 9223372036854775807 999 r = x - y 1000 if r != -9223372036854775808 { 1001 t.Errorf("-1 %s 9223372036854775807 = %d, want -9223372036854775808", "-", r) 1002 } 1003 x = 0 1004 y = -9223372036854775808 1005 r = x - y 1006 if r != -9223372036854775808 { 1007 t.Errorf("0 %s -9223372036854775808 = %d, want -9223372036854775808", "-", r) 1008 } 1009 y = -9223372036854775807 1010 r = x - y 1011 if r != 9223372036854775807 { 1012 t.Errorf("0 %s -9223372036854775807 = %d, want 9223372036854775807", "-", r) 1013 } 1014 y = -4294967296 1015 r = x - y 1016 if r != 4294967296 { 1017 t.Errorf("0 %s -4294967296 = %d, want 4294967296", "-", r) 1018 } 1019 y = -1 1020 r = x - y 1021 if r != 1 { 1022 t.Errorf("0 %s -1 = %d, want 1", "-", r) 1023 } 1024 y = 0 1025 r = x - y 1026 if r != 0 { 1027 t.Errorf("0 %s 0 = %d, want 0", "-", r) 1028 } 1029 y = 1 1030 r = x - y 1031 if r != -1 { 1032 t.Errorf("0 %s 1 = %d, want -1", "-", r) 1033 } 1034 y = 4294967296 1035 r = x - y 1036 if r != -4294967296 { 1037 t.Errorf("0 %s 4294967296 = %d, want -4294967296", "-", r) 1038 } 1039 y = 9223372036854775806 1040 r = x - y 1041 if r != -9223372036854775806 { 1042 t.Errorf("0 %s 9223372036854775806 = %d, want -9223372036854775806", "-", r) 1043 } 1044 y = 9223372036854775807 1045 r = x - y 1046 if r != -9223372036854775807 { 1047 t.Errorf("0 %s 9223372036854775807 = %d, want -9223372036854775807", "-", r) 1048 } 1049 x = 1 1050 y = -9223372036854775808 1051 r = x - y 1052 if r != -9223372036854775807 { 1053 t.Errorf("1 %s -9223372036854775808 = %d, want -9223372036854775807", "-", r) 1054 } 1055 y = -9223372036854775807 1056 r = x - y 1057 if r != -9223372036854775808 { 1058 t.Errorf("1 %s -9223372036854775807 = %d, want -9223372036854775808", "-", r) 1059 } 1060 y = -4294967296 1061 r = x - y 1062 if r != 4294967297 { 1063 t.Errorf("1 %s -4294967296 = %d, want 4294967297", "-", r) 1064 } 1065 y = -1 1066 r = x - y 1067 if r != 2 { 1068 t.Errorf("1 %s -1 = %d, want 2", "-", r) 1069 } 1070 y = 0 1071 r = x - y 1072 if r != 1 { 1073 t.Errorf("1 %s 0 = %d, want 1", "-", r) 1074 } 1075 y = 1 1076 r = x - y 1077 if r != 0 { 1078 t.Errorf("1 %s 1 = %d, want 0", "-", r) 1079 } 1080 y = 4294967296 1081 r = x - y 1082 if r != -4294967295 { 1083 t.Errorf("1 %s 4294967296 = %d, want -4294967295", "-", r) 1084 } 1085 y = 9223372036854775806 1086 r = x - y 1087 if r != -9223372036854775805 { 1088 t.Errorf("1 %s 9223372036854775806 = %d, want -9223372036854775805", "-", r) 1089 } 1090 y = 9223372036854775807 1091 r = x - y 1092 if r != -9223372036854775806 { 1093 t.Errorf("1 %s 9223372036854775807 = %d, want -9223372036854775806", "-", r) 1094 } 1095 x = 4294967296 1096 y = -9223372036854775808 1097 r = x - y 1098 if r != -9223372032559808512 { 1099 t.Errorf("4294967296 %s -9223372036854775808 = %d, want -9223372032559808512", "-", r) 1100 } 1101 y = -9223372036854775807 1102 r = x - y 1103 if r != -9223372032559808513 { 1104 t.Errorf("4294967296 %s -9223372036854775807 = %d, want -9223372032559808513", "-", r) 1105 } 1106 y = -4294967296 1107 r = x - y 1108 if r != 8589934592 { 1109 t.Errorf("4294967296 %s -4294967296 = %d, want 8589934592", "-", r) 1110 } 1111 y = -1 1112 r = x - y 1113 if r != 4294967297 { 1114 t.Errorf("4294967296 %s -1 = %d, want 4294967297", "-", r) 1115 } 1116 y = 0 1117 r = x - y 1118 if r != 4294967296 { 1119 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "-", r) 1120 } 1121 y = 1 1122 r = x - y 1123 if r != 4294967295 { 1124 t.Errorf("4294967296 %s 1 = %d, want 4294967295", "-", r) 1125 } 1126 y = 4294967296 1127 r = x - y 1128 if r != 0 { 1129 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "-", r) 1130 } 1131 y = 9223372036854775806 1132 r = x - y 1133 if r != -9223372032559808510 { 1134 t.Errorf("4294967296 %s 9223372036854775806 = %d, want -9223372032559808510", "-", r) 1135 } 1136 y = 9223372036854775807 1137 r = x - y 1138 if r != -9223372032559808511 { 1139 t.Errorf("4294967296 %s 9223372036854775807 = %d, want -9223372032559808511", "-", r) 1140 } 1141 x = 9223372036854775806 1142 y = -9223372036854775808 1143 r = x - y 1144 if r != -2 { 1145 t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want -2", "-", r) 1146 } 1147 y = -9223372036854775807 1148 r = x - y 1149 if r != -3 { 1150 t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want -3", "-", r) 1151 } 1152 y = -4294967296 1153 r = x - y 1154 if r != -9223372032559808514 { 1155 t.Errorf("9223372036854775806 %s -4294967296 = %d, want -9223372032559808514", "-", r) 1156 } 1157 y = -1 1158 r = x - y 1159 if r != 9223372036854775807 { 1160 t.Errorf("9223372036854775806 %s -1 = %d, want 9223372036854775807", "-", r) 1161 } 1162 y = 0 1163 r = x - y 1164 if r != 9223372036854775806 { 1165 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "-", r) 1166 } 1167 y = 1 1168 r = x - y 1169 if r != 9223372036854775805 { 1170 t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775805", "-", r) 1171 } 1172 y = 4294967296 1173 r = x - y 1174 if r != 9223372032559808510 { 1175 t.Errorf("9223372036854775806 %s 4294967296 = %d, want 9223372032559808510", "-", r) 1176 } 1177 y = 9223372036854775806 1178 r = x - y 1179 if r != 0 { 1180 t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 0", "-", r) 1181 } 1182 y = 9223372036854775807 1183 r = x - y 1184 if r != -1 { 1185 t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want -1", "-", r) 1186 } 1187 x = 9223372036854775807 1188 y = -9223372036854775808 1189 r = x - y 1190 if r != -1 { 1191 t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want -1", "-", r) 1192 } 1193 y = -9223372036854775807 1194 r = x - y 1195 if r != -2 { 1196 t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want -2", "-", r) 1197 } 1198 y = -4294967296 1199 r = x - y 1200 if r != -9223372032559808513 { 1201 t.Errorf("9223372036854775807 %s -4294967296 = %d, want -9223372032559808513", "-", r) 1202 } 1203 y = -1 1204 r = x - y 1205 if r != -9223372036854775808 { 1206 t.Errorf("9223372036854775807 %s -1 = %d, want -9223372036854775808", "-", r) 1207 } 1208 y = 0 1209 r = x - y 1210 if r != 9223372036854775807 { 1211 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "-", r) 1212 } 1213 y = 1 1214 r = x - y 1215 if r != 9223372036854775806 { 1216 t.Errorf("9223372036854775807 %s 1 = %d, want 9223372036854775806", "-", r) 1217 } 1218 y = 4294967296 1219 r = x - y 1220 if r != 9223372032559808511 { 1221 t.Errorf("9223372036854775807 %s 4294967296 = %d, want 9223372032559808511", "-", r) 1222 } 1223 y = 9223372036854775806 1224 r = x - y 1225 if r != 1 { 1226 t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want 1", "-", r) 1227 } 1228 y = 9223372036854775807 1229 r = x - y 1230 if r != 0 { 1231 t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 0", "-", r) 1232 } 1233 } 1234 func TestConstFoldint64div(t *testing.T) { 1235 var x, y, r int64 1236 x = -9223372036854775808 1237 y = -9223372036854775808 1238 r = x / y 1239 if r != 1 { 1240 t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 1", "/", r) 1241 } 1242 y = -9223372036854775807 1243 r = x / y 1244 if r != 1 { 1245 t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want 1", "/", r) 1246 } 1247 y = -4294967296 1248 r = x / y 1249 if r != 2147483648 { 1250 t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 2147483648", "/", r) 1251 } 1252 y = -1 1253 r = x / y 1254 if r != -9223372036854775808 { 1255 t.Errorf("-9223372036854775808 %s -1 = %d, want -9223372036854775808", "/", r) 1256 } 1257 y = 1 1258 r = x / y 1259 if r != -9223372036854775808 { 1260 t.Errorf("-9223372036854775808 %s 1 = %d, want -9223372036854775808", "/", r) 1261 } 1262 y = 4294967296 1263 r = x / y 1264 if r != -2147483648 { 1265 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want -2147483648", "/", r) 1266 } 1267 y = 9223372036854775806 1268 r = x / y 1269 if r != -1 { 1270 t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want -1", "/", r) 1271 } 1272 y = 9223372036854775807 1273 r = x / y 1274 if r != -1 { 1275 t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -1", "/", r) 1276 } 1277 x = -9223372036854775807 1278 y = -9223372036854775808 1279 r = x / y 1280 if r != 0 { 1281 t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want 0", "/", r) 1282 } 1283 y = -9223372036854775807 1284 r = x / y 1285 if r != 1 { 1286 t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 1", "/", r) 1287 } 1288 y = -4294967296 1289 r = x / y 1290 if r != 2147483647 { 1291 t.Errorf("-9223372036854775807 %s -4294967296 = %d, want 2147483647", "/", r) 1292 } 1293 y = -1 1294 r = x / y 1295 if r != 9223372036854775807 { 1296 t.Errorf("-9223372036854775807 %s -1 = %d, want 9223372036854775807", "/", r) 1297 } 1298 y = 1 1299 r = x / y 1300 if r != -9223372036854775807 { 1301 t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775807", "/", r) 1302 } 1303 y = 4294967296 1304 r = x / y 1305 if r != -2147483647 { 1306 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -2147483647", "/", r) 1307 } 1308 y = 9223372036854775806 1309 r = x / y 1310 if r != -1 { 1311 t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want -1", "/", r) 1312 } 1313 y = 9223372036854775807 1314 r = x / y 1315 if r != -1 { 1316 t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want -1", "/", r) 1317 } 1318 x = -4294967296 1319 y = -9223372036854775808 1320 r = x / y 1321 if r != 0 { 1322 t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 0", "/", r) 1323 } 1324 y = -9223372036854775807 1325 r = x / y 1326 if r != 0 { 1327 t.Errorf("-4294967296 %s -9223372036854775807 = %d, want 0", "/", r) 1328 } 1329 y = -4294967296 1330 r = x / y 1331 if r != 1 { 1332 t.Errorf("-4294967296 %s -4294967296 = %d, want 1", "/", r) 1333 } 1334 y = -1 1335 r = x / y 1336 if r != 4294967296 { 1337 t.Errorf("-4294967296 %s -1 = %d, want 4294967296", "/", r) 1338 } 1339 y = 1 1340 r = x / y 1341 if r != -4294967296 { 1342 t.Errorf("-4294967296 %s 1 = %d, want -4294967296", "/", r) 1343 } 1344 y = 4294967296 1345 r = x / y 1346 if r != -1 { 1347 t.Errorf("-4294967296 %s 4294967296 = %d, want -1", "/", r) 1348 } 1349 y = 9223372036854775806 1350 r = x / y 1351 if r != 0 { 1352 t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 0", "/", r) 1353 } 1354 y = 9223372036854775807 1355 r = x / y 1356 if r != 0 { 1357 t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 0", "/", r) 1358 } 1359 x = -1 1360 y = -9223372036854775808 1361 r = x / y 1362 if r != 0 { 1363 t.Errorf("-1 %s -9223372036854775808 = %d, want 0", "/", r) 1364 } 1365 y = -9223372036854775807 1366 r = x / y 1367 if r != 0 { 1368 t.Errorf("-1 %s -9223372036854775807 = %d, want 0", "/", r) 1369 } 1370 y = -4294967296 1371 r = x / y 1372 if r != 0 { 1373 t.Errorf("-1 %s -4294967296 = %d, want 0", "/", r) 1374 } 1375 y = -1 1376 r = x / y 1377 if r != 1 { 1378 t.Errorf("-1 %s -1 = %d, want 1", "/", r) 1379 } 1380 y = 1 1381 r = x / y 1382 if r != -1 { 1383 t.Errorf("-1 %s 1 = %d, want -1", "/", r) 1384 } 1385 y = 4294967296 1386 r = x / y 1387 if r != 0 { 1388 t.Errorf("-1 %s 4294967296 = %d, want 0", "/", r) 1389 } 1390 y = 9223372036854775806 1391 r = x / y 1392 if r != 0 { 1393 t.Errorf("-1 %s 9223372036854775806 = %d, want 0", "/", r) 1394 } 1395 y = 9223372036854775807 1396 r = x / y 1397 if r != 0 { 1398 t.Errorf("-1 %s 9223372036854775807 = %d, want 0", "/", r) 1399 } 1400 x = 0 1401 y = -9223372036854775808 1402 r = x / y 1403 if r != 0 { 1404 t.Errorf("0 %s -9223372036854775808 = %d, want 0", "/", r) 1405 } 1406 y = -9223372036854775807 1407 r = x / y 1408 if r != 0 { 1409 t.Errorf("0 %s -9223372036854775807 = %d, want 0", "/", r) 1410 } 1411 y = -4294967296 1412 r = x / y 1413 if r != 0 { 1414 t.Errorf("0 %s -4294967296 = %d, want 0", "/", r) 1415 } 1416 y = -1 1417 r = x / y 1418 if r != 0 { 1419 t.Errorf("0 %s -1 = %d, want 0", "/", r) 1420 } 1421 y = 1 1422 r = x / y 1423 if r != 0 { 1424 t.Errorf("0 %s 1 = %d, want 0", "/", r) 1425 } 1426 y = 4294967296 1427 r = x / y 1428 if r != 0 { 1429 t.Errorf("0 %s 4294967296 = %d, want 0", "/", r) 1430 } 1431 y = 9223372036854775806 1432 r = x / y 1433 if r != 0 { 1434 t.Errorf("0 %s 9223372036854775806 = %d, want 0", "/", r) 1435 } 1436 y = 9223372036854775807 1437 r = x / y 1438 if r != 0 { 1439 t.Errorf("0 %s 9223372036854775807 = %d, want 0", "/", r) 1440 } 1441 x = 1 1442 y = -9223372036854775808 1443 r = x / y 1444 if r != 0 { 1445 t.Errorf("1 %s -9223372036854775808 = %d, want 0", "/", r) 1446 } 1447 y = -9223372036854775807 1448 r = x / y 1449 if r != 0 { 1450 t.Errorf("1 %s -9223372036854775807 = %d, want 0", "/", r) 1451 } 1452 y = -4294967296 1453 r = x / y 1454 if r != 0 { 1455 t.Errorf("1 %s -4294967296 = %d, want 0", "/", r) 1456 } 1457 y = -1 1458 r = x / y 1459 if r != -1 { 1460 t.Errorf("1 %s -1 = %d, want -1", "/", r) 1461 } 1462 y = 1 1463 r = x / y 1464 if r != 1 { 1465 t.Errorf("1 %s 1 = %d, want 1", "/", r) 1466 } 1467 y = 4294967296 1468 r = x / y 1469 if r != 0 { 1470 t.Errorf("1 %s 4294967296 = %d, want 0", "/", r) 1471 } 1472 y = 9223372036854775806 1473 r = x / y 1474 if r != 0 { 1475 t.Errorf("1 %s 9223372036854775806 = %d, want 0", "/", r) 1476 } 1477 y = 9223372036854775807 1478 r = x / y 1479 if r != 0 { 1480 t.Errorf("1 %s 9223372036854775807 = %d, want 0", "/", r) 1481 } 1482 x = 4294967296 1483 y = -9223372036854775808 1484 r = x / y 1485 if r != 0 { 1486 t.Errorf("4294967296 %s -9223372036854775808 = %d, want 0", "/", r) 1487 } 1488 y = -9223372036854775807 1489 r = x / y 1490 if r != 0 { 1491 t.Errorf("4294967296 %s -9223372036854775807 = %d, want 0", "/", r) 1492 } 1493 y = -4294967296 1494 r = x / y 1495 if r != -1 { 1496 t.Errorf("4294967296 %s -4294967296 = %d, want -1", "/", r) 1497 } 1498 y = -1 1499 r = x / y 1500 if r != -4294967296 { 1501 t.Errorf("4294967296 %s -1 = %d, want -4294967296", "/", r) 1502 } 1503 y = 1 1504 r = x / y 1505 if r != 4294967296 { 1506 t.Errorf("4294967296 %s 1 = %d, want 4294967296", "/", r) 1507 } 1508 y = 4294967296 1509 r = x / y 1510 if r != 1 { 1511 t.Errorf("4294967296 %s 4294967296 = %d, want 1", "/", r) 1512 } 1513 y = 9223372036854775806 1514 r = x / y 1515 if r != 0 { 1516 t.Errorf("4294967296 %s 9223372036854775806 = %d, want 0", "/", r) 1517 } 1518 y = 9223372036854775807 1519 r = x / y 1520 if r != 0 { 1521 t.Errorf("4294967296 %s 9223372036854775807 = %d, want 0", "/", r) 1522 } 1523 x = 9223372036854775806 1524 y = -9223372036854775808 1525 r = x / y 1526 if r != 0 { 1527 t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want 0", "/", r) 1528 } 1529 y = -9223372036854775807 1530 r = x / y 1531 if r != 0 { 1532 t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want 0", "/", r) 1533 } 1534 y = -4294967296 1535 r = x / y 1536 if r != -2147483647 { 1537 t.Errorf("9223372036854775806 %s -4294967296 = %d, want -2147483647", "/", r) 1538 } 1539 y = -1 1540 r = x / y 1541 if r != -9223372036854775806 { 1542 t.Errorf("9223372036854775806 %s -1 = %d, want -9223372036854775806", "/", r) 1543 } 1544 y = 1 1545 r = x / y 1546 if r != 9223372036854775806 { 1547 t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775806", "/", r) 1548 } 1549 y = 4294967296 1550 r = x / y 1551 if r != 2147483647 { 1552 t.Errorf("9223372036854775806 %s 4294967296 = %d, want 2147483647", "/", r) 1553 } 1554 y = 9223372036854775806 1555 r = x / y 1556 if r != 1 { 1557 t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 1", "/", r) 1558 } 1559 y = 9223372036854775807 1560 r = x / y 1561 if r != 0 { 1562 t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want 0", "/", r) 1563 } 1564 x = 9223372036854775807 1565 y = -9223372036854775808 1566 r = x / y 1567 if r != 0 { 1568 t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want 0", "/", r) 1569 } 1570 y = -9223372036854775807 1571 r = x / y 1572 if r != -1 { 1573 t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want -1", "/", r) 1574 } 1575 y = -4294967296 1576 r = x / y 1577 if r != -2147483647 { 1578 t.Errorf("9223372036854775807 %s -4294967296 = %d, want -2147483647", "/", r) 1579 } 1580 y = -1 1581 r = x / y 1582 if r != -9223372036854775807 { 1583 t.Errorf("9223372036854775807 %s -1 = %d, want -9223372036854775807", "/", r) 1584 } 1585 y = 1 1586 r = x / y 1587 if r != 9223372036854775807 { 1588 t.Errorf("9223372036854775807 %s 1 = %d, want 9223372036854775807", "/", r) 1589 } 1590 y = 4294967296 1591 r = x / y 1592 if r != 2147483647 { 1593 t.Errorf("9223372036854775807 %s 4294967296 = %d, want 2147483647", "/", r) 1594 } 1595 y = 9223372036854775806 1596 r = x / y 1597 if r != 1 { 1598 t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want 1", "/", r) 1599 } 1600 y = 9223372036854775807 1601 r = x / y 1602 if r != 1 { 1603 t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 1", "/", r) 1604 } 1605 } 1606 func TestConstFoldint64mul(t *testing.T) { 1607 var x, y, r int64 1608 x = -9223372036854775808 1609 y = -9223372036854775808 1610 r = x * y 1611 if r != 0 { 1612 t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "*", r) 1613 } 1614 y = -9223372036854775807 1615 r = x * y 1616 if r != -9223372036854775808 { 1617 t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want -9223372036854775808", "*", r) 1618 } 1619 y = -4294967296 1620 r = x * y 1621 if r != 0 { 1622 t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 0", "*", r) 1623 } 1624 y = -1 1625 r = x * y 1626 if r != -9223372036854775808 { 1627 t.Errorf("-9223372036854775808 %s -1 = %d, want -9223372036854775808", "*", r) 1628 } 1629 y = 0 1630 r = x * y 1631 if r != 0 { 1632 t.Errorf("-9223372036854775808 %s 0 = %d, want 0", "*", r) 1633 } 1634 y = 1 1635 r = x * y 1636 if r != -9223372036854775808 { 1637 t.Errorf("-9223372036854775808 %s 1 = %d, want -9223372036854775808", "*", r) 1638 } 1639 y = 4294967296 1640 r = x * y 1641 if r != 0 { 1642 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 0", "*", r) 1643 } 1644 y = 9223372036854775806 1645 r = x * y 1646 if r != 0 { 1647 t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want 0", "*", r) 1648 } 1649 y = 9223372036854775807 1650 r = x * y 1651 if r != -9223372036854775808 { 1652 t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -9223372036854775808", "*", r) 1653 } 1654 x = -9223372036854775807 1655 y = -9223372036854775808 1656 r = x * y 1657 if r != -9223372036854775808 { 1658 t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r) 1659 } 1660 y = -9223372036854775807 1661 r = x * y 1662 if r != 1 { 1663 t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 1", "*", r) 1664 } 1665 y = -4294967296 1666 r = x * y 1667 if r != -4294967296 { 1668 t.Errorf("-9223372036854775807 %s -4294967296 = %d, want -4294967296", "*", r) 1669 } 1670 y = -1 1671 r = x * y 1672 if r != 9223372036854775807 { 1673 t.Errorf("-9223372036854775807 %s -1 = %d, want 9223372036854775807", "*", r) 1674 } 1675 y = 0 1676 r = x * y 1677 if r != 0 { 1678 t.Errorf("-9223372036854775807 %s 0 = %d, want 0", "*", r) 1679 } 1680 y = 1 1681 r = x * y 1682 if r != -9223372036854775807 { 1683 t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775807", "*", r) 1684 } 1685 y = 4294967296 1686 r = x * y 1687 if r != 4294967296 { 1688 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want 4294967296", "*", r) 1689 } 1690 y = 9223372036854775806 1691 r = x * y 1692 if r != 9223372036854775806 { 1693 t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want 9223372036854775806", "*", r) 1694 } 1695 y = 9223372036854775807 1696 r = x * y 1697 if r != -1 { 1698 t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want -1", "*", r) 1699 } 1700 x = -4294967296 1701 y = -9223372036854775808 1702 r = x * y 1703 if r != 0 { 1704 t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 0", "*", r) 1705 } 1706 y = -9223372036854775807 1707 r = x * y 1708 if r != -4294967296 { 1709 t.Errorf("-4294967296 %s -9223372036854775807 = %d, want -4294967296", "*", r) 1710 } 1711 y = -4294967296 1712 r = x * y 1713 if r != 0 { 1714 t.Errorf("-4294967296 %s -4294967296 = %d, want 0", "*", r) 1715 } 1716 y = -1 1717 r = x * y 1718 if r != 4294967296 { 1719 t.Errorf("-4294967296 %s -1 = %d, want 4294967296", "*", r) 1720 } 1721 y = 0 1722 r = x * y 1723 if r != 0 { 1724 t.Errorf("-4294967296 %s 0 = %d, want 0", "*", r) 1725 } 1726 y = 1 1727 r = x * y 1728 if r != -4294967296 { 1729 t.Errorf("-4294967296 %s 1 = %d, want -4294967296", "*", r) 1730 } 1731 y = 4294967296 1732 r = x * y 1733 if r != 0 { 1734 t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "*", r) 1735 } 1736 y = 9223372036854775806 1737 r = x * y 1738 if r != 8589934592 { 1739 t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 8589934592", "*", r) 1740 } 1741 y = 9223372036854775807 1742 r = x * y 1743 if r != 4294967296 { 1744 t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 4294967296", "*", r) 1745 } 1746 x = -1 1747 y = -9223372036854775808 1748 r = x * y 1749 if r != -9223372036854775808 { 1750 t.Errorf("-1 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r) 1751 } 1752 y = -9223372036854775807 1753 r = x * y 1754 if r != 9223372036854775807 { 1755 t.Errorf("-1 %s -9223372036854775807 = %d, want 9223372036854775807", "*", r) 1756 } 1757 y = -4294967296 1758 r = x * y 1759 if r != 4294967296 { 1760 t.Errorf("-1 %s -4294967296 = %d, want 4294967296", "*", r) 1761 } 1762 y = -1 1763 r = x * y 1764 if r != 1 { 1765 t.Errorf("-1 %s -1 = %d, want 1", "*", r) 1766 } 1767 y = 0 1768 r = x * y 1769 if r != 0 { 1770 t.Errorf("-1 %s 0 = %d, want 0", "*", r) 1771 } 1772 y = 1 1773 r = x * y 1774 if r != -1 { 1775 t.Errorf("-1 %s 1 = %d, want -1", "*", r) 1776 } 1777 y = 4294967296 1778 r = x * y 1779 if r != -4294967296 { 1780 t.Errorf("-1 %s 4294967296 = %d, want -4294967296", "*", r) 1781 } 1782 y = 9223372036854775806 1783 r = x * y 1784 if r != -9223372036854775806 { 1785 t.Errorf("-1 %s 9223372036854775806 = %d, want -9223372036854775806", "*", r) 1786 } 1787 y = 9223372036854775807 1788 r = x * y 1789 if r != -9223372036854775807 { 1790 t.Errorf("-1 %s 9223372036854775807 = %d, want -9223372036854775807", "*", r) 1791 } 1792 x = 0 1793 y = -9223372036854775808 1794 r = x * y 1795 if r != 0 { 1796 t.Errorf("0 %s -9223372036854775808 = %d, want 0", "*", r) 1797 } 1798 y = -9223372036854775807 1799 r = x * y 1800 if r != 0 { 1801 t.Errorf("0 %s -9223372036854775807 = %d, want 0", "*", r) 1802 } 1803 y = -4294967296 1804 r = x * y 1805 if r != 0 { 1806 t.Errorf("0 %s -4294967296 = %d, want 0", "*", r) 1807 } 1808 y = -1 1809 r = x * y 1810 if r != 0 { 1811 t.Errorf("0 %s -1 = %d, want 0", "*", r) 1812 } 1813 y = 0 1814 r = x * y 1815 if r != 0 { 1816 t.Errorf("0 %s 0 = %d, want 0", "*", r) 1817 } 1818 y = 1 1819 r = x * y 1820 if r != 0 { 1821 t.Errorf("0 %s 1 = %d, want 0", "*", r) 1822 } 1823 y = 4294967296 1824 r = x * y 1825 if r != 0 { 1826 t.Errorf("0 %s 4294967296 = %d, want 0", "*", r) 1827 } 1828 y = 9223372036854775806 1829 r = x * y 1830 if r != 0 { 1831 t.Errorf("0 %s 9223372036854775806 = %d, want 0", "*", r) 1832 } 1833 y = 9223372036854775807 1834 r = x * y 1835 if r != 0 { 1836 t.Errorf("0 %s 9223372036854775807 = %d, want 0", "*", r) 1837 } 1838 x = 1 1839 y = -9223372036854775808 1840 r = x * y 1841 if r != -9223372036854775808 { 1842 t.Errorf("1 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r) 1843 } 1844 y = -9223372036854775807 1845 r = x * y 1846 if r != -9223372036854775807 { 1847 t.Errorf("1 %s -9223372036854775807 = %d, want -9223372036854775807", "*", r) 1848 } 1849 y = -4294967296 1850 r = x * y 1851 if r != -4294967296 { 1852 t.Errorf("1 %s -4294967296 = %d, want -4294967296", "*", r) 1853 } 1854 y = -1 1855 r = x * y 1856 if r != -1 { 1857 t.Errorf("1 %s -1 = %d, want -1", "*", r) 1858 } 1859 y = 0 1860 r = x * y 1861 if r != 0 { 1862 t.Errorf("1 %s 0 = %d, want 0", "*", r) 1863 } 1864 y = 1 1865 r = x * y 1866 if r != 1 { 1867 t.Errorf("1 %s 1 = %d, want 1", "*", r) 1868 } 1869 y = 4294967296 1870 r = x * y 1871 if r != 4294967296 { 1872 t.Errorf("1 %s 4294967296 = %d, want 4294967296", "*", r) 1873 } 1874 y = 9223372036854775806 1875 r = x * y 1876 if r != 9223372036854775806 { 1877 t.Errorf("1 %s 9223372036854775806 = %d, want 9223372036854775806", "*", r) 1878 } 1879 y = 9223372036854775807 1880 r = x * y 1881 if r != 9223372036854775807 { 1882 t.Errorf("1 %s 9223372036854775807 = %d, want 9223372036854775807", "*", r) 1883 } 1884 x = 4294967296 1885 y = -9223372036854775808 1886 r = x * y 1887 if r != 0 { 1888 t.Errorf("4294967296 %s -9223372036854775808 = %d, want 0", "*", r) 1889 } 1890 y = -9223372036854775807 1891 r = x * y 1892 if r != 4294967296 { 1893 t.Errorf("4294967296 %s -9223372036854775807 = %d, want 4294967296", "*", r) 1894 } 1895 y = -4294967296 1896 r = x * y 1897 if r != 0 { 1898 t.Errorf("4294967296 %s -4294967296 = %d, want 0", "*", r) 1899 } 1900 y = -1 1901 r = x * y 1902 if r != -4294967296 { 1903 t.Errorf("4294967296 %s -1 = %d, want -4294967296", "*", r) 1904 } 1905 y = 0 1906 r = x * y 1907 if r != 0 { 1908 t.Errorf("4294967296 %s 0 = %d, want 0", "*", r) 1909 } 1910 y = 1 1911 r = x * y 1912 if r != 4294967296 { 1913 t.Errorf("4294967296 %s 1 = %d, want 4294967296", "*", r) 1914 } 1915 y = 4294967296 1916 r = x * y 1917 if r != 0 { 1918 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "*", r) 1919 } 1920 y = 9223372036854775806 1921 r = x * y 1922 if r != -8589934592 { 1923 t.Errorf("4294967296 %s 9223372036854775806 = %d, want -8589934592", "*", r) 1924 } 1925 y = 9223372036854775807 1926 r = x * y 1927 if r != -4294967296 { 1928 t.Errorf("4294967296 %s 9223372036854775807 = %d, want -4294967296", "*", r) 1929 } 1930 x = 9223372036854775806 1931 y = -9223372036854775808 1932 r = x * y 1933 if r != 0 { 1934 t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want 0", "*", r) 1935 } 1936 y = -9223372036854775807 1937 r = x * y 1938 if r != 9223372036854775806 { 1939 t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want 9223372036854775806", "*", r) 1940 } 1941 y = -4294967296 1942 r = x * y 1943 if r != 8589934592 { 1944 t.Errorf("9223372036854775806 %s -4294967296 = %d, want 8589934592", "*", r) 1945 } 1946 y = -1 1947 r = x * y 1948 if r != -9223372036854775806 { 1949 t.Errorf("9223372036854775806 %s -1 = %d, want -9223372036854775806", "*", r) 1950 } 1951 y = 0 1952 r = x * y 1953 if r != 0 { 1954 t.Errorf("9223372036854775806 %s 0 = %d, want 0", "*", r) 1955 } 1956 y = 1 1957 r = x * y 1958 if r != 9223372036854775806 { 1959 t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775806", "*", r) 1960 } 1961 y = 4294967296 1962 r = x * y 1963 if r != -8589934592 { 1964 t.Errorf("9223372036854775806 %s 4294967296 = %d, want -8589934592", "*", r) 1965 } 1966 y = 9223372036854775806 1967 r = x * y 1968 if r != 4 { 1969 t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 4", "*", r) 1970 } 1971 y = 9223372036854775807 1972 r = x * y 1973 if r != -9223372036854775806 { 1974 t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want -9223372036854775806", "*", r) 1975 } 1976 x = 9223372036854775807 1977 y = -9223372036854775808 1978 r = x * y 1979 if r != -9223372036854775808 { 1980 t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r) 1981 } 1982 y = -9223372036854775807 1983 r = x * y 1984 if r != -1 { 1985 t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want -1", "*", r) 1986 } 1987 y = -4294967296 1988 r = x * y 1989 if r != 4294967296 { 1990 t.Errorf("9223372036854775807 %s -4294967296 = %d, want 4294967296", "*", r) 1991 } 1992 y = -1 1993 r = x * y 1994 if r != -9223372036854775807 { 1995 t.Errorf("9223372036854775807 %s -1 = %d, want -9223372036854775807", "*", r) 1996 } 1997 y = 0 1998 r = x * y 1999 if r != 0 { 2000 t.Errorf("9223372036854775807 %s 0 = %d, want 0", "*", r) 2001 } 2002 y = 1 2003 r = x * y 2004 if r != 9223372036854775807 { 2005 t.Errorf("9223372036854775807 %s 1 = %d, want 9223372036854775807", "*", r) 2006 } 2007 y = 4294967296 2008 r = x * y 2009 if r != -4294967296 { 2010 t.Errorf("9223372036854775807 %s 4294967296 = %d, want -4294967296", "*", r) 2011 } 2012 y = 9223372036854775806 2013 r = x * y 2014 if r != -9223372036854775806 { 2015 t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want -9223372036854775806", "*", r) 2016 } 2017 y = 9223372036854775807 2018 r = x * y 2019 if r != 1 { 2020 t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 1", "*", r) 2021 } 2022 } 2023 func TestConstFoldint64mod(t *testing.T) { 2024 var x, y, r int64 2025 x = -9223372036854775808 2026 y = -9223372036854775808 2027 r = x % y 2028 if r != 0 { 2029 t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "%", r) 2030 } 2031 y = -9223372036854775807 2032 r = x % y 2033 if r != -1 { 2034 t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want -1", "%", r) 2035 } 2036 y = -4294967296 2037 r = x % y 2038 if r != 0 { 2039 t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 0", "%", r) 2040 } 2041 y = -1 2042 r = x % y 2043 if r != 0 { 2044 t.Errorf("-9223372036854775808 %s -1 = %d, want 0", "%", r) 2045 } 2046 y = 1 2047 r = x % y 2048 if r != 0 { 2049 t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "%", r) 2050 } 2051 y = 4294967296 2052 r = x % y 2053 if r != 0 { 2054 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 0", "%", r) 2055 } 2056 y = 9223372036854775806 2057 r = x % y 2058 if r != -2 { 2059 t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want -2", "%", r) 2060 } 2061 y = 9223372036854775807 2062 r = x % y 2063 if r != -1 { 2064 t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -1", "%", r) 2065 } 2066 x = -9223372036854775807 2067 y = -9223372036854775808 2068 r = x % y 2069 if r != -9223372036854775807 { 2070 t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want -9223372036854775807", "%", r) 2071 } 2072 y = -9223372036854775807 2073 r = x % y 2074 if r != 0 { 2075 t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 0", "%", r) 2076 } 2077 y = -4294967296 2078 r = x % y 2079 if r != -4294967295 { 2080 t.Errorf("-9223372036854775807 %s -4294967296 = %d, want -4294967295", "%", r) 2081 } 2082 y = -1 2083 r = x % y 2084 if r != 0 { 2085 t.Errorf("-9223372036854775807 %s -1 = %d, want 0", "%", r) 2086 } 2087 y = 1 2088 r = x % y 2089 if r != 0 { 2090 t.Errorf("-9223372036854775807 %s 1 = %d, want 0", "%", r) 2091 } 2092 y = 4294967296 2093 r = x % y 2094 if r != -4294967295 { 2095 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -4294967295", "%", r) 2096 } 2097 y = 9223372036854775806 2098 r = x % y 2099 if r != -1 { 2100 t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want -1", "%", r) 2101 } 2102 y = 9223372036854775807 2103 r = x % y 2104 if r != 0 { 2105 t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want 0", "%", r) 2106 } 2107 x = -4294967296 2108 y = -9223372036854775808 2109 r = x % y 2110 if r != -4294967296 { 2111 t.Errorf("-4294967296 %s -9223372036854775808 = %d, want -4294967296", "%", r) 2112 } 2113 y = -9223372036854775807 2114 r = x % y 2115 if r != -4294967296 { 2116 t.Errorf("-4294967296 %s -9223372036854775807 = %d, want -4294967296", "%", r) 2117 } 2118 y = -4294967296 2119 r = x % y 2120 if r != 0 { 2121 t.Errorf("-4294967296 %s -4294967296 = %d, want 0", "%", r) 2122 } 2123 y = -1 2124 r = x % y 2125 if r != 0 { 2126 t.Errorf("-4294967296 %s -1 = %d, want 0", "%", r) 2127 } 2128 y = 1 2129 r = x % y 2130 if r != 0 { 2131 t.Errorf("-4294967296 %s 1 = %d, want 0", "%", r) 2132 } 2133 y = 4294967296 2134 r = x % y 2135 if r != 0 { 2136 t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "%", r) 2137 } 2138 y = 9223372036854775806 2139 r = x % y 2140 if r != -4294967296 { 2141 t.Errorf("-4294967296 %s 9223372036854775806 = %d, want -4294967296", "%", r) 2142 } 2143 y = 9223372036854775807 2144 r = x % y 2145 if r != -4294967296 { 2146 t.Errorf("-4294967296 %s 9223372036854775807 = %d, want -4294967296", "%", r) 2147 } 2148 x = -1 2149 y = -9223372036854775808 2150 r = x % y 2151 if r != -1 { 2152 t.Errorf("-1 %s -9223372036854775808 = %d, want -1", "%", r) 2153 } 2154 y = -9223372036854775807 2155 r = x % y 2156 if r != -1 { 2157 t.Errorf("-1 %s -9223372036854775807 = %d, want -1", "%", r) 2158 } 2159 y = -4294967296 2160 r = x % y 2161 if r != -1 { 2162 t.Errorf("-1 %s -4294967296 = %d, want -1", "%", r) 2163 } 2164 y = -1 2165 r = x % y 2166 if r != 0 { 2167 t.Errorf("-1 %s -1 = %d, want 0", "%", r) 2168 } 2169 y = 1 2170 r = x % y 2171 if r != 0 { 2172 t.Errorf("-1 %s 1 = %d, want 0", "%", r) 2173 } 2174 y = 4294967296 2175 r = x % y 2176 if r != -1 { 2177 t.Errorf("-1 %s 4294967296 = %d, want -1", "%", r) 2178 } 2179 y = 9223372036854775806 2180 r = x % y 2181 if r != -1 { 2182 t.Errorf("-1 %s 9223372036854775806 = %d, want -1", "%", r) 2183 } 2184 y = 9223372036854775807 2185 r = x % y 2186 if r != -1 { 2187 t.Errorf("-1 %s 9223372036854775807 = %d, want -1", "%", r) 2188 } 2189 x = 0 2190 y = -9223372036854775808 2191 r = x % y 2192 if r != 0 { 2193 t.Errorf("0 %s -9223372036854775808 = %d, want 0", "%", r) 2194 } 2195 y = -9223372036854775807 2196 r = x % y 2197 if r != 0 { 2198 t.Errorf("0 %s -9223372036854775807 = %d, want 0", "%", r) 2199 } 2200 y = -4294967296 2201 r = x % y 2202 if r != 0 { 2203 t.Errorf("0 %s -4294967296 = %d, want 0", "%", r) 2204 } 2205 y = -1 2206 r = x % y 2207 if r != 0 { 2208 t.Errorf("0 %s -1 = %d, want 0", "%", r) 2209 } 2210 y = 1 2211 r = x % y 2212 if r != 0 { 2213 t.Errorf("0 %s 1 = %d, want 0", "%", r) 2214 } 2215 y = 4294967296 2216 r = x % y 2217 if r != 0 { 2218 t.Errorf("0 %s 4294967296 = %d, want 0", "%", r) 2219 } 2220 y = 9223372036854775806 2221 r = x % y 2222 if r != 0 { 2223 t.Errorf("0 %s 9223372036854775806 = %d, want 0", "%", r) 2224 } 2225 y = 9223372036854775807 2226 r = x % y 2227 if r != 0 { 2228 t.Errorf("0 %s 9223372036854775807 = %d, want 0", "%", r) 2229 } 2230 x = 1 2231 y = -9223372036854775808 2232 r = x % y 2233 if r != 1 { 2234 t.Errorf("1 %s -9223372036854775808 = %d, want 1", "%", r) 2235 } 2236 y = -9223372036854775807 2237 r = x % y 2238 if r != 1 { 2239 t.Errorf("1 %s -9223372036854775807 = %d, want 1", "%", r) 2240 } 2241 y = -4294967296 2242 r = x % y 2243 if r != 1 { 2244 t.Errorf("1 %s -4294967296 = %d, want 1", "%", r) 2245 } 2246 y = -1 2247 r = x % y 2248 if r != 0 { 2249 t.Errorf("1 %s -1 = %d, want 0", "%", r) 2250 } 2251 y = 1 2252 r = x % y 2253 if r != 0 { 2254 t.Errorf("1 %s 1 = %d, want 0", "%", r) 2255 } 2256 y = 4294967296 2257 r = x % y 2258 if r != 1 { 2259 t.Errorf("1 %s 4294967296 = %d, want 1", "%", r) 2260 } 2261 y = 9223372036854775806 2262 r = x % y 2263 if r != 1 { 2264 t.Errorf("1 %s 9223372036854775806 = %d, want 1", "%", r) 2265 } 2266 y = 9223372036854775807 2267 r = x % y 2268 if r != 1 { 2269 t.Errorf("1 %s 9223372036854775807 = %d, want 1", "%", r) 2270 } 2271 x = 4294967296 2272 y = -9223372036854775808 2273 r = x % y 2274 if r != 4294967296 { 2275 t.Errorf("4294967296 %s -9223372036854775808 = %d, want 4294967296", "%", r) 2276 } 2277 y = -9223372036854775807 2278 r = x % y 2279 if r != 4294967296 { 2280 t.Errorf("4294967296 %s -9223372036854775807 = %d, want 4294967296", "%", r) 2281 } 2282 y = -4294967296 2283 r = x % y 2284 if r != 0 { 2285 t.Errorf("4294967296 %s -4294967296 = %d, want 0", "%", r) 2286 } 2287 y = -1 2288 r = x % y 2289 if r != 0 { 2290 t.Errorf("4294967296 %s -1 = %d, want 0", "%", r) 2291 } 2292 y = 1 2293 r = x % y 2294 if r != 0 { 2295 t.Errorf("4294967296 %s 1 = %d, want 0", "%", r) 2296 } 2297 y = 4294967296 2298 r = x % y 2299 if r != 0 { 2300 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "%", r) 2301 } 2302 y = 9223372036854775806 2303 r = x % y 2304 if r != 4294967296 { 2305 t.Errorf("4294967296 %s 9223372036854775806 = %d, want 4294967296", "%", r) 2306 } 2307 y = 9223372036854775807 2308 r = x % y 2309 if r != 4294967296 { 2310 t.Errorf("4294967296 %s 9223372036854775807 = %d, want 4294967296", "%", r) 2311 } 2312 x = 9223372036854775806 2313 y = -9223372036854775808 2314 r = x % y 2315 if r != 9223372036854775806 { 2316 t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want 9223372036854775806", "%", r) 2317 } 2318 y = -9223372036854775807 2319 r = x % y 2320 if r != 9223372036854775806 { 2321 t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want 9223372036854775806", "%", r) 2322 } 2323 y = -4294967296 2324 r = x % y 2325 if r != 4294967294 { 2326 t.Errorf("9223372036854775806 %s -4294967296 = %d, want 4294967294", "%", r) 2327 } 2328 y = -1 2329 r = x % y 2330 if r != 0 { 2331 t.Errorf("9223372036854775806 %s -1 = %d, want 0", "%", r) 2332 } 2333 y = 1 2334 r = x % y 2335 if r != 0 { 2336 t.Errorf("9223372036854775806 %s 1 = %d, want 0", "%", r) 2337 } 2338 y = 4294967296 2339 r = x % y 2340 if r != 4294967294 { 2341 t.Errorf("9223372036854775806 %s 4294967296 = %d, want 4294967294", "%", r) 2342 } 2343 y = 9223372036854775806 2344 r = x % y 2345 if r != 0 { 2346 t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 0", "%", r) 2347 } 2348 y = 9223372036854775807 2349 r = x % y 2350 if r != 9223372036854775806 { 2351 t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want 9223372036854775806", "%", r) 2352 } 2353 x = 9223372036854775807 2354 y = -9223372036854775808 2355 r = x % y 2356 if r != 9223372036854775807 { 2357 t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want 9223372036854775807", "%", r) 2358 } 2359 y = -9223372036854775807 2360 r = x % y 2361 if r != 0 { 2362 t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want 0", "%", r) 2363 } 2364 y = -4294967296 2365 r = x % y 2366 if r != 4294967295 { 2367 t.Errorf("9223372036854775807 %s -4294967296 = %d, want 4294967295", "%", r) 2368 } 2369 y = -1 2370 r = x % y 2371 if r != 0 { 2372 t.Errorf("9223372036854775807 %s -1 = %d, want 0", "%", r) 2373 } 2374 y = 1 2375 r = x % y 2376 if r != 0 { 2377 t.Errorf("9223372036854775807 %s 1 = %d, want 0", "%", r) 2378 } 2379 y = 4294967296 2380 r = x % y 2381 if r != 4294967295 { 2382 t.Errorf("9223372036854775807 %s 4294967296 = %d, want 4294967295", "%", r) 2383 } 2384 y = 9223372036854775806 2385 r = x % y 2386 if r != 1 { 2387 t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want 1", "%", r) 2388 } 2389 y = 9223372036854775807 2390 r = x % y 2391 if r != 0 { 2392 t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 0", "%", r) 2393 } 2394 } 2395 func TestConstFolduint32add(t *testing.T) { 2396 var x, y, r uint32 2397 x = 0 2398 y = 0 2399 r = x + y 2400 if r != 0 { 2401 t.Errorf("0 %s 0 = %d, want 0", "+", r) 2402 } 2403 y = 1 2404 r = x + y 2405 if r != 1 { 2406 t.Errorf("0 %s 1 = %d, want 1", "+", r) 2407 } 2408 y = 4294967295 2409 r = x + y 2410 if r != 4294967295 { 2411 t.Errorf("0 %s 4294967295 = %d, want 4294967295", "+", r) 2412 } 2413 x = 1 2414 y = 0 2415 r = x + y 2416 if r != 1 { 2417 t.Errorf("1 %s 0 = %d, want 1", "+", r) 2418 } 2419 y = 1 2420 r = x + y 2421 if r != 2 { 2422 t.Errorf("1 %s 1 = %d, want 2", "+", r) 2423 } 2424 y = 4294967295 2425 r = x + y 2426 if r != 0 { 2427 t.Errorf("1 %s 4294967295 = %d, want 0", "+", r) 2428 } 2429 x = 4294967295 2430 y = 0 2431 r = x + y 2432 if r != 4294967295 { 2433 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "+", r) 2434 } 2435 y = 1 2436 r = x + y 2437 if r != 0 { 2438 t.Errorf("4294967295 %s 1 = %d, want 0", "+", r) 2439 } 2440 y = 4294967295 2441 r = x + y 2442 if r != 4294967294 { 2443 t.Errorf("4294967295 %s 4294967295 = %d, want 4294967294", "+", r) 2444 } 2445 } 2446 func TestConstFolduint32sub(t *testing.T) { 2447 var x, y, r uint32 2448 x = 0 2449 y = 0 2450 r = x - y 2451 if r != 0 { 2452 t.Errorf("0 %s 0 = %d, want 0", "-", r) 2453 } 2454 y = 1 2455 r = x - y 2456 if r != 4294967295 { 2457 t.Errorf("0 %s 1 = %d, want 4294967295", "-", r) 2458 } 2459 y = 4294967295 2460 r = x - y 2461 if r != 1 { 2462 t.Errorf("0 %s 4294967295 = %d, want 1", "-", r) 2463 } 2464 x = 1 2465 y = 0 2466 r = x - y 2467 if r != 1 { 2468 t.Errorf("1 %s 0 = %d, want 1", "-", r) 2469 } 2470 y = 1 2471 r = x - y 2472 if r != 0 { 2473 t.Errorf("1 %s 1 = %d, want 0", "-", r) 2474 } 2475 y = 4294967295 2476 r = x - y 2477 if r != 2 { 2478 t.Errorf("1 %s 4294967295 = %d, want 2", "-", r) 2479 } 2480 x = 4294967295 2481 y = 0 2482 r = x - y 2483 if r != 4294967295 { 2484 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "-", r) 2485 } 2486 y = 1 2487 r = x - y 2488 if r != 4294967294 { 2489 t.Errorf("4294967295 %s 1 = %d, want 4294967294", "-", r) 2490 } 2491 y = 4294967295 2492 r = x - y 2493 if r != 0 { 2494 t.Errorf("4294967295 %s 4294967295 = %d, want 0", "-", r) 2495 } 2496 } 2497 func TestConstFolduint32div(t *testing.T) { 2498 var x, y, r uint32 2499 x = 0 2500 y = 1 2501 r = x / y 2502 if r != 0 { 2503 t.Errorf("0 %s 1 = %d, want 0", "/", r) 2504 } 2505 y = 4294967295 2506 r = x / y 2507 if r != 0 { 2508 t.Errorf("0 %s 4294967295 = %d, want 0", "/", r) 2509 } 2510 x = 1 2511 y = 1 2512 r = x / y 2513 if r != 1 { 2514 t.Errorf("1 %s 1 = %d, want 1", "/", r) 2515 } 2516 y = 4294967295 2517 r = x / y 2518 if r != 0 { 2519 t.Errorf("1 %s 4294967295 = %d, want 0", "/", r) 2520 } 2521 x = 4294967295 2522 y = 1 2523 r = x / y 2524 if r != 4294967295 { 2525 t.Errorf("4294967295 %s 1 = %d, want 4294967295", "/", r) 2526 } 2527 y = 4294967295 2528 r = x / y 2529 if r != 1 { 2530 t.Errorf("4294967295 %s 4294967295 = %d, want 1", "/", r) 2531 } 2532 } 2533 func TestConstFolduint32mul(t *testing.T) { 2534 var x, y, r uint32 2535 x = 0 2536 y = 0 2537 r = x * y 2538 if r != 0 { 2539 t.Errorf("0 %s 0 = %d, want 0", "*", r) 2540 } 2541 y = 1 2542 r = x * y 2543 if r != 0 { 2544 t.Errorf("0 %s 1 = %d, want 0", "*", r) 2545 } 2546 y = 4294967295 2547 r = x * y 2548 if r != 0 { 2549 t.Errorf("0 %s 4294967295 = %d, want 0", "*", r) 2550 } 2551 x = 1 2552 y = 0 2553 r = x * y 2554 if r != 0 { 2555 t.Errorf("1 %s 0 = %d, want 0", "*", r) 2556 } 2557 y = 1 2558 r = x * y 2559 if r != 1 { 2560 t.Errorf("1 %s 1 = %d, want 1", "*", r) 2561 } 2562 y = 4294967295 2563 r = x * y 2564 if r != 4294967295 { 2565 t.Errorf("1 %s 4294967295 = %d, want 4294967295", "*", r) 2566 } 2567 x = 4294967295 2568 y = 0 2569 r = x * y 2570 if r != 0 { 2571 t.Errorf("4294967295 %s 0 = %d, want 0", "*", r) 2572 } 2573 y = 1 2574 r = x * y 2575 if r != 4294967295 { 2576 t.Errorf("4294967295 %s 1 = %d, want 4294967295", "*", r) 2577 } 2578 y = 4294967295 2579 r = x * y 2580 if r != 1 { 2581 t.Errorf("4294967295 %s 4294967295 = %d, want 1", "*", r) 2582 } 2583 } 2584 func TestConstFolduint32mod(t *testing.T) { 2585 var x, y, r uint32 2586 x = 0 2587 y = 1 2588 r = x % y 2589 if r != 0 { 2590 t.Errorf("0 %s 1 = %d, want 0", "%", r) 2591 } 2592 y = 4294967295 2593 r = x % y 2594 if r != 0 { 2595 t.Errorf("0 %s 4294967295 = %d, want 0", "%", r) 2596 } 2597 x = 1 2598 y = 1 2599 r = x % y 2600 if r != 0 { 2601 t.Errorf("1 %s 1 = %d, want 0", "%", r) 2602 } 2603 y = 4294967295 2604 r = x % y 2605 if r != 1 { 2606 t.Errorf("1 %s 4294967295 = %d, want 1", "%", r) 2607 } 2608 x = 4294967295 2609 y = 1 2610 r = x % y 2611 if r != 0 { 2612 t.Errorf("4294967295 %s 1 = %d, want 0", "%", r) 2613 } 2614 y = 4294967295 2615 r = x % y 2616 if r != 0 { 2617 t.Errorf("4294967295 %s 4294967295 = %d, want 0", "%", r) 2618 } 2619 } 2620 func TestConstFoldint32add(t *testing.T) { 2621 var x, y, r int32 2622 x = -2147483648 2623 y = -2147483648 2624 r = x + y 2625 if r != 0 { 2626 t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "+", r) 2627 } 2628 y = -2147483647 2629 r = x + y 2630 if r != 1 { 2631 t.Errorf("-2147483648 %s -2147483647 = %d, want 1", "+", r) 2632 } 2633 y = -1 2634 r = x + y 2635 if r != 2147483647 { 2636 t.Errorf("-2147483648 %s -1 = %d, want 2147483647", "+", r) 2637 } 2638 y = 0 2639 r = x + y 2640 if r != -2147483648 { 2641 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "+", r) 2642 } 2643 y = 1 2644 r = x + y 2645 if r != -2147483647 { 2646 t.Errorf("-2147483648 %s 1 = %d, want -2147483647", "+", r) 2647 } 2648 y = 2147483647 2649 r = x + y 2650 if r != -1 { 2651 t.Errorf("-2147483648 %s 2147483647 = %d, want -1", "+", r) 2652 } 2653 x = -2147483647 2654 y = -2147483648 2655 r = x + y 2656 if r != 1 { 2657 t.Errorf("-2147483647 %s -2147483648 = %d, want 1", "+", r) 2658 } 2659 y = -2147483647 2660 r = x + y 2661 if r != 2 { 2662 t.Errorf("-2147483647 %s -2147483647 = %d, want 2", "+", r) 2663 } 2664 y = -1 2665 r = x + y 2666 if r != -2147483648 { 2667 t.Errorf("-2147483647 %s -1 = %d, want -2147483648", "+", r) 2668 } 2669 y = 0 2670 r = x + y 2671 if r != -2147483647 { 2672 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "+", r) 2673 } 2674 y = 1 2675 r = x + y 2676 if r != -2147483646 { 2677 t.Errorf("-2147483647 %s 1 = %d, want -2147483646", "+", r) 2678 } 2679 y = 2147483647 2680 r = x + y 2681 if r != 0 { 2682 t.Errorf("-2147483647 %s 2147483647 = %d, want 0", "+", r) 2683 } 2684 x = -1 2685 y = -2147483648 2686 r = x + y 2687 if r != 2147483647 { 2688 t.Errorf("-1 %s -2147483648 = %d, want 2147483647", "+", r) 2689 } 2690 y = -2147483647 2691 r = x + y 2692 if r != -2147483648 { 2693 t.Errorf("-1 %s -2147483647 = %d, want -2147483648", "+", r) 2694 } 2695 y = -1 2696 r = x + y 2697 if r != -2 { 2698 t.Errorf("-1 %s -1 = %d, want -2", "+", r) 2699 } 2700 y = 0 2701 r = x + y 2702 if r != -1 { 2703 t.Errorf("-1 %s 0 = %d, want -1", "+", r) 2704 } 2705 y = 1 2706 r = x + y 2707 if r != 0 { 2708 t.Errorf("-1 %s 1 = %d, want 0", "+", r) 2709 } 2710 y = 2147483647 2711 r = x + y 2712 if r != 2147483646 { 2713 t.Errorf("-1 %s 2147483647 = %d, want 2147483646", "+", r) 2714 } 2715 x = 0 2716 y = -2147483648 2717 r = x + y 2718 if r != -2147483648 { 2719 t.Errorf("0 %s -2147483648 = %d, want -2147483648", "+", r) 2720 } 2721 y = -2147483647 2722 r = x + y 2723 if r != -2147483647 { 2724 t.Errorf("0 %s -2147483647 = %d, want -2147483647", "+", r) 2725 } 2726 y = -1 2727 r = x + y 2728 if r != -1 { 2729 t.Errorf("0 %s -1 = %d, want -1", "+", r) 2730 } 2731 y = 0 2732 r = x + y 2733 if r != 0 { 2734 t.Errorf("0 %s 0 = %d, want 0", "+", r) 2735 } 2736 y = 1 2737 r = x + y 2738 if r != 1 { 2739 t.Errorf("0 %s 1 = %d, want 1", "+", r) 2740 } 2741 y = 2147483647 2742 r = x + y 2743 if r != 2147483647 { 2744 t.Errorf("0 %s 2147483647 = %d, want 2147483647", "+", r) 2745 } 2746 x = 1 2747 y = -2147483648 2748 r = x + y 2749 if r != -2147483647 { 2750 t.Errorf("1 %s -2147483648 = %d, want -2147483647", "+", r) 2751 } 2752 y = -2147483647 2753 r = x + y 2754 if r != -2147483646 { 2755 t.Errorf("1 %s -2147483647 = %d, want -2147483646", "+", r) 2756 } 2757 y = -1 2758 r = x + y 2759 if r != 0 { 2760 t.Errorf("1 %s -1 = %d, want 0", "+", r) 2761 } 2762 y = 0 2763 r = x + y 2764 if r != 1 { 2765 t.Errorf("1 %s 0 = %d, want 1", "+", r) 2766 } 2767 y = 1 2768 r = x + y 2769 if r != 2 { 2770 t.Errorf("1 %s 1 = %d, want 2", "+", r) 2771 } 2772 y = 2147483647 2773 r = x + y 2774 if r != -2147483648 { 2775 t.Errorf("1 %s 2147483647 = %d, want -2147483648", "+", r) 2776 } 2777 x = 2147483647 2778 y = -2147483648 2779 r = x + y 2780 if r != -1 { 2781 t.Errorf("2147483647 %s -2147483648 = %d, want -1", "+", r) 2782 } 2783 y = -2147483647 2784 r = x + y 2785 if r != 0 { 2786 t.Errorf("2147483647 %s -2147483647 = %d, want 0", "+", r) 2787 } 2788 y = -1 2789 r = x + y 2790 if r != 2147483646 { 2791 t.Errorf("2147483647 %s -1 = %d, want 2147483646", "+", r) 2792 } 2793 y = 0 2794 r = x + y 2795 if r != 2147483647 { 2796 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "+", r) 2797 } 2798 y = 1 2799 r = x + y 2800 if r != -2147483648 { 2801 t.Errorf("2147483647 %s 1 = %d, want -2147483648", "+", r) 2802 } 2803 y = 2147483647 2804 r = x + y 2805 if r != -2 { 2806 t.Errorf("2147483647 %s 2147483647 = %d, want -2", "+", r) 2807 } 2808 } 2809 func TestConstFoldint32sub(t *testing.T) { 2810 var x, y, r int32 2811 x = -2147483648 2812 y = -2147483648 2813 r = x - y 2814 if r != 0 { 2815 t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "-", r) 2816 } 2817 y = -2147483647 2818 r = x - y 2819 if r != -1 { 2820 t.Errorf("-2147483648 %s -2147483647 = %d, want -1", "-", r) 2821 } 2822 y = -1 2823 r = x - y 2824 if r != -2147483647 { 2825 t.Errorf("-2147483648 %s -1 = %d, want -2147483647", "-", r) 2826 } 2827 y = 0 2828 r = x - y 2829 if r != -2147483648 { 2830 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "-", r) 2831 } 2832 y = 1 2833 r = x - y 2834 if r != 2147483647 { 2835 t.Errorf("-2147483648 %s 1 = %d, want 2147483647", "-", r) 2836 } 2837 y = 2147483647 2838 r = x - y 2839 if r != 1 { 2840 t.Errorf("-2147483648 %s 2147483647 = %d, want 1", "-", r) 2841 } 2842 x = -2147483647 2843 y = -2147483648 2844 r = x - y 2845 if r != 1 { 2846 t.Errorf("-2147483647 %s -2147483648 = %d, want 1", "-", r) 2847 } 2848 y = -2147483647 2849 r = x - y 2850 if r != 0 { 2851 t.Errorf("-2147483647 %s -2147483647 = %d, want 0", "-", r) 2852 } 2853 y = -1 2854 r = x - y 2855 if r != -2147483646 { 2856 t.Errorf("-2147483647 %s -1 = %d, want -2147483646", "-", r) 2857 } 2858 y = 0 2859 r = x - y 2860 if r != -2147483647 { 2861 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "-", r) 2862 } 2863 y = 1 2864 r = x - y 2865 if r != -2147483648 { 2866 t.Errorf("-2147483647 %s 1 = %d, want -2147483648", "-", r) 2867 } 2868 y = 2147483647 2869 r = x - y 2870 if r != 2 { 2871 t.Errorf("-2147483647 %s 2147483647 = %d, want 2", "-", r) 2872 } 2873 x = -1 2874 y = -2147483648 2875 r = x - y 2876 if r != 2147483647 { 2877 t.Errorf("-1 %s -2147483648 = %d, want 2147483647", "-", r) 2878 } 2879 y = -2147483647 2880 r = x - y 2881 if r != 2147483646 { 2882 t.Errorf("-1 %s -2147483647 = %d, want 2147483646", "-", r) 2883 } 2884 y = -1 2885 r = x - y 2886 if r != 0 { 2887 t.Errorf("-1 %s -1 = %d, want 0", "-", r) 2888 } 2889 y = 0 2890 r = x - y 2891 if r != -1 { 2892 t.Errorf("-1 %s 0 = %d, want -1", "-", r) 2893 } 2894 y = 1 2895 r = x - y 2896 if r != -2 { 2897 t.Errorf("-1 %s 1 = %d, want -2", "-", r) 2898 } 2899 y = 2147483647 2900 r = x - y 2901 if r != -2147483648 { 2902 t.Errorf("-1 %s 2147483647 = %d, want -2147483648", "-", r) 2903 } 2904 x = 0 2905 y = -2147483648 2906 r = x - y 2907 if r != -2147483648 { 2908 t.Errorf("0 %s -2147483648 = %d, want -2147483648", "-", r) 2909 } 2910 y = -2147483647 2911 r = x - y 2912 if r != 2147483647 { 2913 t.Errorf("0 %s -2147483647 = %d, want 2147483647", "-", r) 2914 } 2915 y = -1 2916 r = x - y 2917 if r != 1 { 2918 t.Errorf("0 %s -1 = %d, want 1", "-", r) 2919 } 2920 y = 0 2921 r = x - y 2922 if r != 0 { 2923 t.Errorf("0 %s 0 = %d, want 0", "-", r) 2924 } 2925 y = 1 2926 r = x - y 2927 if r != -1 { 2928 t.Errorf("0 %s 1 = %d, want -1", "-", r) 2929 } 2930 y = 2147483647 2931 r = x - y 2932 if r != -2147483647 { 2933 t.Errorf("0 %s 2147483647 = %d, want -2147483647", "-", r) 2934 } 2935 x = 1 2936 y = -2147483648 2937 r = x - y 2938 if r != -2147483647 { 2939 t.Errorf("1 %s -2147483648 = %d, want -2147483647", "-", r) 2940 } 2941 y = -2147483647 2942 r = x - y 2943 if r != -2147483648 { 2944 t.Errorf("1 %s -2147483647 = %d, want -2147483648", "-", r) 2945 } 2946 y = -1 2947 r = x - y 2948 if r != 2 { 2949 t.Errorf("1 %s -1 = %d, want 2", "-", r) 2950 } 2951 y = 0 2952 r = x - y 2953 if r != 1 { 2954 t.Errorf("1 %s 0 = %d, want 1", "-", r) 2955 } 2956 y = 1 2957 r = x - y 2958 if r != 0 { 2959 t.Errorf("1 %s 1 = %d, want 0", "-", r) 2960 } 2961 y = 2147483647 2962 r = x - y 2963 if r != -2147483646 { 2964 t.Errorf("1 %s 2147483647 = %d, want -2147483646", "-", r) 2965 } 2966 x = 2147483647 2967 y = -2147483648 2968 r = x - y 2969 if r != -1 { 2970 t.Errorf("2147483647 %s -2147483648 = %d, want -1", "-", r) 2971 } 2972 y = -2147483647 2973 r = x - y 2974 if r != -2 { 2975 t.Errorf("2147483647 %s -2147483647 = %d, want -2", "-", r) 2976 } 2977 y = -1 2978 r = x - y 2979 if r != -2147483648 { 2980 t.Errorf("2147483647 %s -1 = %d, want -2147483648", "-", r) 2981 } 2982 y = 0 2983 r = x - y 2984 if r != 2147483647 { 2985 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "-", r) 2986 } 2987 y = 1 2988 r = x - y 2989 if r != 2147483646 { 2990 t.Errorf("2147483647 %s 1 = %d, want 2147483646", "-", r) 2991 } 2992 y = 2147483647 2993 r = x - y 2994 if r != 0 { 2995 t.Errorf("2147483647 %s 2147483647 = %d, want 0", "-", r) 2996 } 2997 } 2998 func TestConstFoldint32div(t *testing.T) { 2999 var x, y, r int32 3000 x = -2147483648 3001 y = -2147483648 3002 r = x / y 3003 if r != 1 { 3004 t.Errorf("-2147483648 %s -2147483648 = %d, want 1", "/", r) 3005 } 3006 y = -2147483647 3007 r = x / y 3008 if r != 1 { 3009 t.Errorf("-2147483648 %s -2147483647 = %d, want 1", "/", r) 3010 } 3011 y = -1 3012 r = x / y 3013 if r != -2147483648 { 3014 t.Errorf("-2147483648 %s -1 = %d, want -2147483648", "/", r) 3015 } 3016 y = 1 3017 r = x / y 3018 if r != -2147483648 { 3019 t.Errorf("-2147483648 %s 1 = %d, want -2147483648", "/", r) 3020 } 3021 y = 2147483647 3022 r = x / y 3023 if r != -1 { 3024 t.Errorf("-2147483648 %s 2147483647 = %d, want -1", "/", r) 3025 } 3026 x = -2147483647 3027 y = -2147483648 3028 r = x / y 3029 if r != 0 { 3030 t.Errorf("-2147483647 %s -2147483648 = %d, want 0", "/", r) 3031 } 3032 y = -2147483647 3033 r = x / y 3034 if r != 1 { 3035 t.Errorf("-2147483647 %s -2147483647 = %d, want 1", "/", r) 3036 } 3037 y = -1 3038 r = x / y 3039 if r != 2147483647 { 3040 t.Errorf("-2147483647 %s -1 = %d, want 2147483647", "/", r) 3041 } 3042 y = 1 3043 r = x / y 3044 if r != -2147483647 { 3045 t.Errorf("-2147483647 %s 1 = %d, want -2147483647", "/", r) 3046 } 3047 y = 2147483647 3048 r = x / y 3049 if r != -1 { 3050 t.Errorf("-2147483647 %s 2147483647 = %d, want -1", "/", r) 3051 } 3052 x = -1 3053 y = -2147483648 3054 r = x / y 3055 if r != 0 { 3056 t.Errorf("-1 %s -2147483648 = %d, want 0", "/", r) 3057 } 3058 y = -2147483647 3059 r = x / y 3060 if r != 0 { 3061 t.Errorf("-1 %s -2147483647 = %d, want 0", "/", r) 3062 } 3063 y = -1 3064 r = x / y 3065 if r != 1 { 3066 t.Errorf("-1 %s -1 = %d, want 1", "/", r) 3067 } 3068 y = 1 3069 r = x / y 3070 if r != -1 { 3071 t.Errorf("-1 %s 1 = %d, want -1", "/", r) 3072 } 3073 y = 2147483647 3074 r = x / y 3075 if r != 0 { 3076 t.Errorf("-1 %s 2147483647 = %d, want 0", "/", r) 3077 } 3078 x = 0 3079 y = -2147483648 3080 r = x / y 3081 if r != 0 { 3082 t.Errorf("0 %s -2147483648 = %d, want 0", "/", r) 3083 } 3084 y = -2147483647 3085 r = x / y 3086 if r != 0 { 3087 t.Errorf("0 %s -2147483647 = %d, want 0", "/", r) 3088 } 3089 y = -1 3090 r = x / y 3091 if r != 0 { 3092 t.Errorf("0 %s -1 = %d, want 0", "/", r) 3093 } 3094 y = 1 3095 r = x / y 3096 if r != 0 { 3097 t.Errorf("0 %s 1 = %d, want 0", "/", r) 3098 } 3099 y = 2147483647 3100 r = x / y 3101 if r != 0 { 3102 t.Errorf("0 %s 2147483647 = %d, want 0", "/", r) 3103 } 3104 x = 1 3105 y = -2147483648 3106 r = x / y 3107 if r != 0 { 3108 t.Errorf("1 %s -2147483648 = %d, want 0", "/", r) 3109 } 3110 y = -2147483647 3111 r = x / y 3112 if r != 0 { 3113 t.Errorf("1 %s -2147483647 = %d, want 0", "/", r) 3114 } 3115 y = -1 3116 r = x / y 3117 if r != -1 { 3118 t.Errorf("1 %s -1 = %d, want -1", "/", r) 3119 } 3120 y = 1 3121 r = x / y 3122 if r != 1 { 3123 t.Errorf("1 %s 1 = %d, want 1", "/", r) 3124 } 3125 y = 2147483647 3126 r = x / y 3127 if r != 0 { 3128 t.Errorf("1 %s 2147483647 = %d, want 0", "/", r) 3129 } 3130 x = 2147483647 3131 y = -2147483648 3132 r = x / y 3133 if r != 0 { 3134 t.Errorf("2147483647 %s -2147483648 = %d, want 0", "/", r) 3135 } 3136 y = -2147483647 3137 r = x / y 3138 if r != -1 { 3139 t.Errorf("2147483647 %s -2147483647 = %d, want -1", "/", r) 3140 } 3141 y = -1 3142 r = x / y 3143 if r != -2147483647 { 3144 t.Errorf("2147483647 %s -1 = %d, want -2147483647", "/", r) 3145 } 3146 y = 1 3147 r = x / y 3148 if r != 2147483647 { 3149 t.Errorf("2147483647 %s 1 = %d, want 2147483647", "/", r) 3150 } 3151 y = 2147483647 3152 r = x / y 3153 if r != 1 { 3154 t.Errorf("2147483647 %s 2147483647 = %d, want 1", "/", r) 3155 } 3156 } 3157 func TestConstFoldint32mul(t *testing.T) { 3158 var x, y, r int32 3159 x = -2147483648 3160 y = -2147483648 3161 r = x * y 3162 if r != 0 { 3163 t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "*", r) 3164 } 3165 y = -2147483647 3166 r = x * y 3167 if r != -2147483648 { 3168 t.Errorf("-2147483648 %s -2147483647 = %d, want -2147483648", "*", r) 3169 } 3170 y = -1 3171 r = x * y 3172 if r != -2147483648 { 3173 t.Errorf("-2147483648 %s -1 = %d, want -2147483648", "*", r) 3174 } 3175 y = 0 3176 r = x * y 3177 if r != 0 { 3178 t.Errorf("-2147483648 %s 0 = %d, want 0", "*", r) 3179 } 3180 y = 1 3181 r = x * y 3182 if r != -2147483648 { 3183 t.Errorf("-2147483648 %s 1 = %d, want -2147483648", "*", r) 3184 } 3185 y = 2147483647 3186 r = x * y 3187 if r != -2147483648 { 3188 t.Errorf("-2147483648 %s 2147483647 = %d, want -2147483648", "*", r) 3189 } 3190 x = -2147483647 3191 y = -2147483648 3192 r = x * y 3193 if r != -2147483648 { 3194 t.Errorf("-2147483647 %s -2147483648 = %d, want -2147483648", "*", r) 3195 } 3196 y = -2147483647 3197 r = x * y 3198 if r != 1 { 3199 t.Errorf("-2147483647 %s -2147483647 = %d, want 1", "*", r) 3200 } 3201 y = -1 3202 r = x * y 3203 if r != 2147483647 { 3204 t.Errorf("-2147483647 %s -1 = %d, want 2147483647", "*", r) 3205 } 3206 y = 0 3207 r = x * y 3208 if r != 0 { 3209 t.Errorf("-2147483647 %s 0 = %d, want 0", "*", r) 3210 } 3211 y = 1 3212 r = x * y 3213 if r != -2147483647 { 3214 t.Errorf("-2147483647 %s 1 = %d, want -2147483647", "*", r) 3215 } 3216 y = 2147483647 3217 r = x * y 3218 if r != -1 { 3219 t.Errorf("-2147483647 %s 2147483647 = %d, want -1", "*", r) 3220 } 3221 x = -1 3222 y = -2147483648 3223 r = x * y 3224 if r != -2147483648 { 3225 t.Errorf("-1 %s -2147483648 = %d, want -2147483648", "*", r) 3226 } 3227 y = -2147483647 3228 r = x * y 3229 if r != 2147483647 { 3230 t.Errorf("-1 %s -2147483647 = %d, want 2147483647", "*", r) 3231 } 3232 y = -1 3233 r = x * y 3234 if r != 1 { 3235 t.Errorf("-1 %s -1 = %d, want 1", "*", r) 3236 } 3237 y = 0 3238 r = x * y 3239 if r != 0 { 3240 t.Errorf("-1 %s 0 = %d, want 0", "*", r) 3241 } 3242 y = 1 3243 r = x * y 3244 if r != -1 { 3245 t.Errorf("-1 %s 1 = %d, want -1", "*", r) 3246 } 3247 y = 2147483647 3248 r = x * y 3249 if r != -2147483647 { 3250 t.Errorf("-1 %s 2147483647 = %d, want -2147483647", "*", r) 3251 } 3252 x = 0 3253 y = -2147483648 3254 r = x * y 3255 if r != 0 { 3256 t.Errorf("0 %s -2147483648 = %d, want 0", "*", r) 3257 } 3258 y = -2147483647 3259 r = x * y 3260 if r != 0 { 3261 t.Errorf("0 %s -2147483647 = %d, want 0", "*", r) 3262 } 3263 y = -1 3264 r = x * y 3265 if r != 0 { 3266 t.Errorf("0 %s -1 = %d, want 0", "*", r) 3267 } 3268 y = 0 3269 r = x * y 3270 if r != 0 { 3271 t.Errorf("0 %s 0 = %d, want 0", "*", r) 3272 } 3273 y = 1 3274 r = x * y 3275 if r != 0 { 3276 t.Errorf("0 %s 1 = %d, want 0", "*", r) 3277 } 3278 y = 2147483647 3279 r = x * y 3280 if r != 0 { 3281 t.Errorf("0 %s 2147483647 = %d, want 0", "*", r) 3282 } 3283 x = 1 3284 y = -2147483648 3285 r = x * y 3286 if r != -2147483648 { 3287 t.Errorf("1 %s -2147483648 = %d, want -2147483648", "*", r) 3288 } 3289 y = -2147483647 3290 r = x * y 3291 if r != -2147483647 { 3292 t.Errorf("1 %s -2147483647 = %d, want -2147483647", "*", r) 3293 } 3294 y = -1 3295 r = x * y 3296 if r != -1 { 3297 t.Errorf("1 %s -1 = %d, want -1", "*", r) 3298 } 3299 y = 0 3300 r = x * y 3301 if r != 0 { 3302 t.Errorf("1 %s 0 = %d, want 0", "*", r) 3303 } 3304 y = 1 3305 r = x * y 3306 if r != 1 { 3307 t.Errorf("1 %s 1 = %d, want 1", "*", r) 3308 } 3309 y = 2147483647 3310 r = x * y 3311 if r != 2147483647 { 3312 t.Errorf("1 %s 2147483647 = %d, want 2147483647", "*", r) 3313 } 3314 x = 2147483647 3315 y = -2147483648 3316 r = x * y 3317 if r != -2147483648 { 3318 t.Errorf("2147483647 %s -2147483648 = %d, want -2147483648", "*", r) 3319 } 3320 y = -2147483647 3321 r = x * y 3322 if r != -1 { 3323 t.Errorf("2147483647 %s -2147483647 = %d, want -1", "*", r) 3324 } 3325 y = -1 3326 r = x * y 3327 if r != -2147483647 { 3328 t.Errorf("2147483647 %s -1 = %d, want -2147483647", "*", r) 3329 } 3330 y = 0 3331 r = x * y 3332 if r != 0 { 3333 t.Errorf("2147483647 %s 0 = %d, want 0", "*", r) 3334 } 3335 y = 1 3336 r = x * y 3337 if r != 2147483647 { 3338 t.Errorf("2147483647 %s 1 = %d, want 2147483647", "*", r) 3339 } 3340 y = 2147483647 3341 r = x * y 3342 if r != 1 { 3343 t.Errorf("2147483647 %s 2147483647 = %d, want 1", "*", r) 3344 } 3345 } 3346 func TestConstFoldint32mod(t *testing.T) { 3347 var x, y, r int32 3348 x = -2147483648 3349 y = -2147483648 3350 r = x % y 3351 if r != 0 { 3352 t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "%", r) 3353 } 3354 y = -2147483647 3355 r = x % y 3356 if r != -1 { 3357 t.Errorf("-2147483648 %s -2147483647 = %d, want -1", "%", r) 3358 } 3359 y = -1 3360 r = x % y 3361 if r != 0 { 3362 t.Errorf("-2147483648 %s -1 = %d, want 0", "%", r) 3363 } 3364 y = 1 3365 r = x % y 3366 if r != 0 { 3367 t.Errorf("-2147483648 %s 1 = %d, want 0", "%", r) 3368 } 3369 y = 2147483647 3370 r = x % y 3371 if r != -1 { 3372 t.Errorf("-2147483648 %s 2147483647 = %d, want -1", "%", r) 3373 } 3374 x = -2147483647 3375 y = -2147483648 3376 r = x % y 3377 if r != -2147483647 { 3378 t.Errorf("-2147483647 %s -2147483648 = %d, want -2147483647", "%", r) 3379 } 3380 y = -2147483647 3381 r = x % y 3382 if r != 0 { 3383 t.Errorf("-2147483647 %s -2147483647 = %d, want 0", "%", r) 3384 } 3385 y = -1 3386 r = x % y 3387 if r != 0 { 3388 t.Errorf("-2147483647 %s -1 = %d, want 0", "%", r) 3389 } 3390 y = 1 3391 r = x % y 3392 if r != 0 { 3393 t.Errorf("-2147483647 %s 1 = %d, want 0", "%", r) 3394 } 3395 y = 2147483647 3396 r = x % y 3397 if r != 0 { 3398 t.Errorf("-2147483647 %s 2147483647 = %d, want 0", "%", r) 3399 } 3400 x = -1 3401 y = -2147483648 3402 r = x % y 3403 if r != -1 { 3404 t.Errorf("-1 %s -2147483648 = %d, want -1", "%", r) 3405 } 3406 y = -2147483647 3407 r = x % y 3408 if r != -1 { 3409 t.Errorf("-1 %s -2147483647 = %d, want -1", "%", r) 3410 } 3411 y = -1 3412 r = x % y 3413 if r != 0 { 3414 t.Errorf("-1 %s -1 = %d, want 0", "%", r) 3415 } 3416 y = 1 3417 r = x % y 3418 if r != 0 { 3419 t.Errorf("-1 %s 1 = %d, want 0", "%", r) 3420 } 3421 y = 2147483647 3422 r = x % y 3423 if r != -1 { 3424 t.Errorf("-1 %s 2147483647 = %d, want -1", "%", r) 3425 } 3426 x = 0 3427 y = -2147483648 3428 r = x % y 3429 if r != 0 { 3430 t.Errorf("0 %s -2147483648 = %d, want 0", "%", r) 3431 } 3432 y = -2147483647 3433 r = x % y 3434 if r != 0 { 3435 t.Errorf("0 %s -2147483647 = %d, want 0", "%", r) 3436 } 3437 y = -1 3438 r = x % y 3439 if r != 0 { 3440 t.Errorf("0 %s -1 = %d, want 0", "%", r) 3441 } 3442 y = 1 3443 r = x % y 3444 if r != 0 { 3445 t.Errorf("0 %s 1 = %d, want 0", "%", r) 3446 } 3447 y = 2147483647 3448 r = x % y 3449 if r != 0 { 3450 t.Errorf("0 %s 2147483647 = %d, want 0", "%", r) 3451 } 3452 x = 1 3453 y = -2147483648 3454 r = x % y 3455 if r != 1 { 3456 t.Errorf("1 %s -2147483648 = %d, want 1", "%", r) 3457 } 3458 y = -2147483647 3459 r = x % y 3460 if r != 1 { 3461 t.Errorf("1 %s -2147483647 = %d, want 1", "%", r) 3462 } 3463 y = -1 3464 r = x % y 3465 if r != 0 { 3466 t.Errorf("1 %s -1 = %d, want 0", "%", r) 3467 } 3468 y = 1 3469 r = x % y 3470 if r != 0 { 3471 t.Errorf("1 %s 1 = %d, want 0", "%", r) 3472 } 3473 y = 2147483647 3474 r = x % y 3475 if r != 1 { 3476 t.Errorf("1 %s 2147483647 = %d, want 1", "%", r) 3477 } 3478 x = 2147483647 3479 y = -2147483648 3480 r = x % y 3481 if r != 2147483647 { 3482 t.Errorf("2147483647 %s -2147483648 = %d, want 2147483647", "%", r) 3483 } 3484 y = -2147483647 3485 r = x % y 3486 if r != 0 { 3487 t.Errorf("2147483647 %s -2147483647 = %d, want 0", "%", r) 3488 } 3489 y = -1 3490 r = x % y 3491 if r != 0 { 3492 t.Errorf("2147483647 %s -1 = %d, want 0", "%", r) 3493 } 3494 y = 1 3495 r = x % y 3496 if r != 0 { 3497 t.Errorf("2147483647 %s 1 = %d, want 0", "%", r) 3498 } 3499 y = 2147483647 3500 r = x % y 3501 if r != 0 { 3502 t.Errorf("2147483647 %s 2147483647 = %d, want 0", "%", r) 3503 } 3504 } 3505 func TestConstFolduint16add(t *testing.T) { 3506 var x, y, r uint16 3507 x = 0 3508 y = 0 3509 r = x + y 3510 if r != 0 { 3511 t.Errorf("0 %s 0 = %d, want 0", "+", r) 3512 } 3513 y = 1 3514 r = x + y 3515 if r != 1 { 3516 t.Errorf("0 %s 1 = %d, want 1", "+", r) 3517 } 3518 y = 65535 3519 r = x + y 3520 if r != 65535 { 3521 t.Errorf("0 %s 65535 = %d, want 65535", "+", r) 3522 } 3523 x = 1 3524 y = 0 3525 r = x + y 3526 if r != 1 { 3527 t.Errorf("1 %s 0 = %d, want 1", "+", r) 3528 } 3529 y = 1 3530 r = x + y 3531 if r != 2 { 3532 t.Errorf("1 %s 1 = %d, want 2", "+", r) 3533 } 3534 y = 65535 3535 r = x + y 3536 if r != 0 { 3537 t.Errorf("1 %s 65535 = %d, want 0", "+", r) 3538 } 3539 x = 65535 3540 y = 0 3541 r = x + y 3542 if r != 65535 { 3543 t.Errorf("65535 %s 0 = %d, want 65535", "+", r) 3544 } 3545 y = 1 3546 r = x + y 3547 if r != 0 { 3548 t.Errorf("65535 %s 1 = %d, want 0", "+", r) 3549 } 3550 y = 65535 3551 r = x + y 3552 if r != 65534 { 3553 t.Errorf("65535 %s 65535 = %d, want 65534", "+", r) 3554 } 3555 } 3556 func TestConstFolduint16sub(t *testing.T) { 3557 var x, y, r uint16 3558 x = 0 3559 y = 0 3560 r = x - y 3561 if r != 0 { 3562 t.Errorf("0 %s 0 = %d, want 0", "-", r) 3563 } 3564 y = 1 3565 r = x - y 3566 if r != 65535 { 3567 t.Errorf("0 %s 1 = %d, want 65535", "-", r) 3568 } 3569 y = 65535 3570 r = x - y 3571 if r != 1 { 3572 t.Errorf("0 %s 65535 = %d, want 1", "-", r) 3573 } 3574 x = 1 3575 y = 0 3576 r = x - y 3577 if r != 1 { 3578 t.Errorf("1 %s 0 = %d, want 1", "-", r) 3579 } 3580 y = 1 3581 r = x - y 3582 if r != 0 { 3583 t.Errorf("1 %s 1 = %d, want 0", "-", r) 3584 } 3585 y = 65535 3586 r = x - y 3587 if r != 2 { 3588 t.Errorf("1 %s 65535 = %d, want 2", "-", r) 3589 } 3590 x = 65535 3591 y = 0 3592 r = x - y 3593 if r != 65535 { 3594 t.Errorf("65535 %s 0 = %d, want 65535", "-", r) 3595 } 3596 y = 1 3597 r = x - y 3598 if r != 65534 { 3599 t.Errorf("65535 %s 1 = %d, want 65534", "-", r) 3600 } 3601 y = 65535 3602 r = x - y 3603 if r != 0 { 3604 t.Errorf("65535 %s 65535 = %d, want 0", "-", r) 3605 } 3606 } 3607 func TestConstFolduint16div(t *testing.T) { 3608 var x, y, r uint16 3609 x = 0 3610 y = 1 3611 r = x / y 3612 if r != 0 { 3613 t.Errorf("0 %s 1 = %d, want 0", "/", r) 3614 } 3615 y = 65535 3616 r = x / y 3617 if r != 0 { 3618 t.Errorf("0 %s 65535 = %d, want 0", "/", r) 3619 } 3620 x = 1 3621 y = 1 3622 r = x / y 3623 if r != 1 { 3624 t.Errorf("1 %s 1 = %d, want 1", "/", r) 3625 } 3626 y = 65535 3627 r = x / y 3628 if r != 0 { 3629 t.Errorf("1 %s 65535 = %d, want 0", "/", r) 3630 } 3631 x = 65535 3632 y = 1 3633 r = x / y 3634 if r != 65535 { 3635 t.Errorf("65535 %s 1 = %d, want 65535", "/", r) 3636 } 3637 y = 65535 3638 r = x / y 3639 if r != 1 { 3640 t.Errorf("65535 %s 65535 = %d, want 1", "/", r) 3641 } 3642 } 3643 func TestConstFolduint16mul(t *testing.T) { 3644 var x, y, r uint16 3645 x = 0 3646 y = 0 3647 r = x * y 3648 if r != 0 { 3649 t.Errorf("0 %s 0 = %d, want 0", "*", r) 3650 } 3651 y = 1 3652 r = x * y 3653 if r != 0 { 3654 t.Errorf("0 %s 1 = %d, want 0", "*", r) 3655 } 3656 y = 65535 3657 r = x * y 3658 if r != 0 { 3659 t.Errorf("0 %s 65535 = %d, want 0", "*", r) 3660 } 3661 x = 1 3662 y = 0 3663 r = x * y 3664 if r != 0 { 3665 t.Errorf("1 %s 0 = %d, want 0", "*", r) 3666 } 3667 y = 1 3668 r = x * y 3669 if r != 1 { 3670 t.Errorf("1 %s 1 = %d, want 1", "*", r) 3671 } 3672 y = 65535 3673 r = x * y 3674 if r != 65535 { 3675 t.Errorf("1 %s 65535 = %d, want 65535", "*", r) 3676 } 3677 x = 65535 3678 y = 0 3679 r = x * y 3680 if r != 0 { 3681 t.Errorf("65535 %s 0 = %d, want 0", "*", r) 3682 } 3683 y = 1 3684 r = x * y 3685 if r != 65535 { 3686 t.Errorf("65535 %s 1 = %d, want 65535", "*", r) 3687 } 3688 y = 65535 3689 r = x * y 3690 if r != 1 { 3691 t.Errorf("65535 %s 65535 = %d, want 1", "*", r) 3692 } 3693 } 3694 func TestConstFolduint16mod(t *testing.T) { 3695 var x, y, r uint16 3696 x = 0 3697 y = 1 3698 r = x % y 3699 if r != 0 { 3700 t.Errorf("0 %s 1 = %d, want 0", "%", r) 3701 } 3702 y = 65535 3703 r = x % y 3704 if r != 0 { 3705 t.Errorf("0 %s 65535 = %d, want 0", "%", r) 3706 } 3707 x = 1 3708 y = 1 3709 r = x % y 3710 if r != 0 { 3711 t.Errorf("1 %s 1 = %d, want 0", "%", r) 3712 } 3713 y = 65535 3714 r = x % y 3715 if r != 1 { 3716 t.Errorf("1 %s 65535 = %d, want 1", "%", r) 3717 } 3718 x = 65535 3719 y = 1 3720 r = x % y 3721 if r != 0 { 3722 t.Errorf("65535 %s 1 = %d, want 0", "%", r) 3723 } 3724 y = 65535 3725 r = x % y 3726 if r != 0 { 3727 t.Errorf("65535 %s 65535 = %d, want 0", "%", r) 3728 } 3729 } 3730 func TestConstFoldint16add(t *testing.T) { 3731 var x, y, r int16 3732 x = -32768 3733 y = -32768 3734 r = x + y 3735 if r != 0 { 3736 t.Errorf("-32768 %s -32768 = %d, want 0", "+", r) 3737 } 3738 y = -32767 3739 r = x + y 3740 if r != 1 { 3741 t.Errorf("-32768 %s -32767 = %d, want 1", "+", r) 3742 } 3743 y = -1 3744 r = x + y 3745 if r != 32767 { 3746 t.Errorf("-32768 %s -1 = %d, want 32767", "+", r) 3747 } 3748 y = 0 3749 r = x + y 3750 if r != -32768 { 3751 t.Errorf("-32768 %s 0 = %d, want -32768", "+", r) 3752 } 3753 y = 1 3754 r = x + y 3755 if r != -32767 { 3756 t.Errorf("-32768 %s 1 = %d, want -32767", "+", r) 3757 } 3758 y = 32766 3759 r = x + y 3760 if r != -2 { 3761 t.Errorf("-32768 %s 32766 = %d, want -2", "+", r) 3762 } 3763 y = 32767 3764 r = x + y 3765 if r != -1 { 3766 t.Errorf("-32768 %s 32767 = %d, want -1", "+", r) 3767 } 3768 x = -32767 3769 y = -32768 3770 r = x + y 3771 if r != 1 { 3772 t.Errorf("-32767 %s -32768 = %d, want 1", "+", r) 3773 } 3774 y = -32767 3775 r = x + y 3776 if r != 2 { 3777 t.Errorf("-32767 %s -32767 = %d, want 2", "+", r) 3778 } 3779 y = -1 3780 r = x + y 3781 if r != -32768 { 3782 t.Errorf("-32767 %s -1 = %d, want -32768", "+", r) 3783 } 3784 y = 0 3785 r = x + y 3786 if r != -32767 { 3787 t.Errorf("-32767 %s 0 = %d, want -32767", "+", r) 3788 } 3789 y = 1 3790 r = x + y 3791 if r != -32766 { 3792 t.Errorf("-32767 %s 1 = %d, want -32766", "+", r) 3793 } 3794 y = 32766 3795 r = x + y 3796 if r != -1 { 3797 t.Errorf("-32767 %s 32766 = %d, want -1", "+", r) 3798 } 3799 y = 32767 3800 r = x + y 3801 if r != 0 { 3802 t.Errorf("-32767 %s 32767 = %d, want 0", "+", r) 3803 } 3804 x = -1 3805 y = -32768 3806 r = x + y 3807 if r != 32767 { 3808 t.Errorf("-1 %s -32768 = %d, want 32767", "+", r) 3809 } 3810 y = -32767 3811 r = x + y 3812 if r != -32768 { 3813 t.Errorf("-1 %s -32767 = %d, want -32768", "+", r) 3814 } 3815 y = -1 3816 r = x + y 3817 if r != -2 { 3818 t.Errorf("-1 %s -1 = %d, want -2", "+", r) 3819 } 3820 y = 0 3821 r = x + y 3822 if r != -1 { 3823 t.Errorf("-1 %s 0 = %d, want -1", "+", r) 3824 } 3825 y = 1 3826 r = x + y 3827 if r != 0 { 3828 t.Errorf("-1 %s 1 = %d, want 0", "+", r) 3829 } 3830 y = 32766 3831 r = x + y 3832 if r != 32765 { 3833 t.Errorf("-1 %s 32766 = %d, want 32765", "+", r) 3834 } 3835 y = 32767 3836 r = x + y 3837 if r != 32766 { 3838 t.Errorf("-1 %s 32767 = %d, want 32766", "+", r) 3839 } 3840 x = 0 3841 y = -32768 3842 r = x + y 3843 if r != -32768 { 3844 t.Errorf("0 %s -32768 = %d, want -32768", "+", r) 3845 } 3846 y = -32767 3847 r = x + y 3848 if r != -32767 { 3849 t.Errorf("0 %s -32767 = %d, want -32767", "+", r) 3850 } 3851 y = -1 3852 r = x + y 3853 if r != -1 { 3854 t.Errorf("0 %s -1 = %d, want -1", "+", r) 3855 } 3856 y = 0 3857 r = x + y 3858 if r != 0 { 3859 t.Errorf("0 %s 0 = %d, want 0", "+", r) 3860 } 3861 y = 1 3862 r = x + y 3863 if r != 1 { 3864 t.Errorf("0 %s 1 = %d, want 1", "+", r) 3865 } 3866 y = 32766 3867 r = x + y 3868 if r != 32766 { 3869 t.Errorf("0 %s 32766 = %d, want 32766", "+", r) 3870 } 3871 y = 32767 3872 r = x + y 3873 if r != 32767 { 3874 t.Errorf("0 %s 32767 = %d, want 32767", "+", r) 3875 } 3876 x = 1 3877 y = -32768 3878 r = x + y 3879 if r != -32767 { 3880 t.Errorf("1 %s -32768 = %d, want -32767", "+", r) 3881 } 3882 y = -32767 3883 r = x + y 3884 if r != -32766 { 3885 t.Errorf("1 %s -32767 = %d, want -32766", "+", r) 3886 } 3887 y = -1 3888 r = x + y 3889 if r != 0 { 3890 t.Errorf("1 %s -1 = %d, want 0", "+", r) 3891 } 3892 y = 0 3893 r = x + y 3894 if r != 1 { 3895 t.Errorf("1 %s 0 = %d, want 1", "+", r) 3896 } 3897 y = 1 3898 r = x + y 3899 if r != 2 { 3900 t.Errorf("1 %s 1 = %d, want 2", "+", r) 3901 } 3902 y = 32766 3903 r = x + y 3904 if r != 32767 { 3905 t.Errorf("1 %s 32766 = %d, want 32767", "+", r) 3906 } 3907 y = 32767 3908 r = x + y 3909 if r != -32768 { 3910 t.Errorf("1 %s 32767 = %d, want -32768", "+", r) 3911 } 3912 x = 32766 3913 y = -32768 3914 r = x + y 3915 if r != -2 { 3916 t.Errorf("32766 %s -32768 = %d, want -2", "+", r) 3917 } 3918 y = -32767 3919 r = x + y 3920 if r != -1 { 3921 t.Errorf("32766 %s -32767 = %d, want -1", "+", r) 3922 } 3923 y = -1 3924 r = x + y 3925 if r != 32765 { 3926 t.Errorf("32766 %s -1 = %d, want 32765", "+", r) 3927 } 3928 y = 0 3929 r = x + y 3930 if r != 32766 { 3931 t.Errorf("32766 %s 0 = %d, want 32766", "+", r) 3932 } 3933 y = 1 3934 r = x + y 3935 if r != 32767 { 3936 t.Errorf("32766 %s 1 = %d, want 32767", "+", r) 3937 } 3938 y = 32766 3939 r = x + y 3940 if r != -4 { 3941 t.Errorf("32766 %s 32766 = %d, want -4", "+", r) 3942 } 3943 y = 32767 3944 r = x + y 3945 if r != -3 { 3946 t.Errorf("32766 %s 32767 = %d, want -3", "+", r) 3947 } 3948 x = 32767 3949 y = -32768 3950 r = x + y 3951 if r != -1 { 3952 t.Errorf("32767 %s -32768 = %d, want -1", "+", r) 3953 } 3954 y = -32767 3955 r = x + y 3956 if r != 0 { 3957 t.Errorf("32767 %s -32767 = %d, want 0", "+", r) 3958 } 3959 y = -1 3960 r = x + y 3961 if r != 32766 { 3962 t.Errorf("32767 %s -1 = %d, want 32766", "+", r) 3963 } 3964 y = 0 3965 r = x + y 3966 if r != 32767 { 3967 t.Errorf("32767 %s 0 = %d, want 32767", "+", r) 3968 } 3969 y = 1 3970 r = x + y 3971 if r != -32768 { 3972 t.Errorf("32767 %s 1 = %d, want -32768", "+", r) 3973 } 3974 y = 32766 3975 r = x + y 3976 if r != -3 { 3977 t.Errorf("32767 %s 32766 = %d, want -3", "+", r) 3978 } 3979 y = 32767 3980 r = x + y 3981 if r != -2 { 3982 t.Errorf("32767 %s 32767 = %d, want -2", "+", r) 3983 } 3984 } 3985 func TestConstFoldint16sub(t *testing.T) { 3986 var x, y, r int16 3987 x = -32768 3988 y = -32768 3989 r = x - y 3990 if r != 0 { 3991 t.Errorf("-32768 %s -32768 = %d, want 0", "-", r) 3992 } 3993 y = -32767 3994 r = x - y 3995 if r != -1 { 3996 t.Errorf("-32768 %s -32767 = %d, want -1", "-", r) 3997 } 3998 y = -1 3999 r = x - y 4000 if r != -32767 { 4001 t.Errorf("-32768 %s -1 = %d, want -32767", "-", r) 4002 } 4003 y = 0 4004 r = x - y 4005 if r != -32768 { 4006 t.Errorf("-32768 %s 0 = %d, want -32768", "-", r) 4007 } 4008 y = 1 4009 r = x - y 4010 if r != 32767 { 4011 t.Errorf("-32768 %s 1 = %d, want 32767", "-", r) 4012 } 4013 y = 32766 4014 r = x - y 4015 if r != 2 { 4016 t.Errorf("-32768 %s 32766 = %d, want 2", "-", r) 4017 } 4018 y = 32767 4019 r = x - y 4020 if r != 1 { 4021 t.Errorf("-32768 %s 32767 = %d, want 1", "-", r) 4022 } 4023 x = -32767 4024 y = -32768 4025 r = x - y 4026 if r != 1 { 4027 t.Errorf("-32767 %s -32768 = %d, want 1", "-", r) 4028 } 4029 y = -32767 4030 r = x - y 4031 if r != 0 { 4032 t.Errorf("-32767 %s -32767 = %d, want 0", "-", r) 4033 } 4034 y = -1 4035 r = x - y 4036 if r != -32766 { 4037 t.Errorf("-32767 %s -1 = %d, want -32766", "-", r) 4038 } 4039 y = 0 4040 r = x - y 4041 if r != -32767 { 4042 t.Errorf("-32767 %s 0 = %d, want -32767", "-", r) 4043 } 4044 y = 1 4045 r = x - y 4046 if r != -32768 { 4047 t.Errorf("-32767 %s 1 = %d, want -32768", "-", r) 4048 } 4049 y = 32766 4050 r = x - y 4051 if r != 3 { 4052 t.Errorf("-32767 %s 32766 = %d, want 3", "-", r) 4053 } 4054 y = 32767 4055 r = x - y 4056 if r != 2 { 4057 t.Errorf("-32767 %s 32767 = %d, want 2", "-", r) 4058 } 4059 x = -1 4060 y = -32768 4061 r = x - y 4062 if r != 32767 { 4063 t.Errorf("-1 %s -32768 = %d, want 32767", "-", r) 4064 } 4065 y = -32767 4066 r = x - y 4067 if r != 32766 { 4068 t.Errorf("-1 %s -32767 = %d, want 32766", "-", r) 4069 } 4070 y = -1 4071 r = x - y 4072 if r != 0 { 4073 t.Errorf("-1 %s -1 = %d, want 0", "-", r) 4074 } 4075 y = 0 4076 r = x - y 4077 if r != -1 { 4078 t.Errorf("-1 %s 0 = %d, want -1", "-", r) 4079 } 4080 y = 1 4081 r = x - y 4082 if r != -2 { 4083 t.Errorf("-1 %s 1 = %d, want -2", "-", r) 4084 } 4085 y = 32766 4086 r = x - y 4087 if r != -32767 { 4088 t.Errorf("-1 %s 32766 = %d, want -32767", "-", r) 4089 } 4090 y = 32767 4091 r = x - y 4092 if r != -32768 { 4093 t.Errorf("-1 %s 32767 = %d, want -32768", "-", r) 4094 } 4095 x = 0 4096 y = -32768 4097 r = x - y 4098 if r != -32768 { 4099 t.Errorf("0 %s -32768 = %d, want -32768", "-", r) 4100 } 4101 y = -32767 4102 r = x - y 4103 if r != 32767 { 4104 t.Errorf("0 %s -32767 = %d, want 32767", "-", r) 4105 } 4106 y = -1 4107 r = x - y 4108 if r != 1 { 4109 t.Errorf("0 %s -1 = %d, want 1", "-", r) 4110 } 4111 y = 0 4112 r = x - y 4113 if r != 0 { 4114 t.Errorf("0 %s 0 = %d, want 0", "-", r) 4115 } 4116 y = 1 4117 r = x - y 4118 if r != -1 { 4119 t.Errorf("0 %s 1 = %d, want -1", "-", r) 4120 } 4121 y = 32766 4122 r = x - y 4123 if r != -32766 { 4124 t.Errorf("0 %s 32766 = %d, want -32766", "-", r) 4125 } 4126 y = 32767 4127 r = x - y 4128 if r != -32767 { 4129 t.Errorf("0 %s 32767 = %d, want -32767", "-", r) 4130 } 4131 x = 1 4132 y = -32768 4133 r = x - y 4134 if r != -32767 { 4135 t.Errorf("1 %s -32768 = %d, want -32767", "-", r) 4136 } 4137 y = -32767 4138 r = x - y 4139 if r != -32768 { 4140 t.Errorf("1 %s -32767 = %d, want -32768", "-", r) 4141 } 4142 y = -1 4143 r = x - y 4144 if r != 2 { 4145 t.Errorf("1 %s -1 = %d, want 2", "-", r) 4146 } 4147 y = 0 4148 r = x - y 4149 if r != 1 { 4150 t.Errorf("1 %s 0 = %d, want 1", "-", r) 4151 } 4152 y = 1 4153 r = x - y 4154 if r != 0 { 4155 t.Errorf("1 %s 1 = %d, want 0", "-", r) 4156 } 4157 y = 32766 4158 r = x - y 4159 if r != -32765 { 4160 t.Errorf("1 %s 32766 = %d, want -32765", "-", r) 4161 } 4162 y = 32767 4163 r = x - y 4164 if r != -32766 { 4165 t.Errorf("1 %s 32767 = %d, want -32766", "-", r) 4166 } 4167 x = 32766 4168 y = -32768 4169 r = x - y 4170 if r != -2 { 4171 t.Errorf("32766 %s -32768 = %d, want -2", "-", r) 4172 } 4173 y = -32767 4174 r = x - y 4175 if r != -3 { 4176 t.Errorf("32766 %s -32767 = %d, want -3", "-", r) 4177 } 4178 y = -1 4179 r = x - y 4180 if r != 32767 { 4181 t.Errorf("32766 %s -1 = %d, want 32767", "-", r) 4182 } 4183 y = 0 4184 r = x - y 4185 if r != 32766 { 4186 t.Errorf("32766 %s 0 = %d, want 32766", "-", r) 4187 } 4188 y = 1 4189 r = x - y 4190 if r != 32765 { 4191 t.Errorf("32766 %s 1 = %d, want 32765", "-", r) 4192 } 4193 y = 32766 4194 r = x - y 4195 if r != 0 { 4196 t.Errorf("32766 %s 32766 = %d, want 0", "-", r) 4197 } 4198 y = 32767 4199 r = x - y 4200 if r != -1 { 4201 t.Errorf("32766 %s 32767 = %d, want -1", "-", r) 4202 } 4203 x = 32767 4204 y = -32768 4205 r = x - y 4206 if r != -1 { 4207 t.Errorf("32767 %s -32768 = %d, want -1", "-", r) 4208 } 4209 y = -32767 4210 r = x - y 4211 if r != -2 { 4212 t.Errorf("32767 %s -32767 = %d, want -2", "-", r) 4213 } 4214 y = -1 4215 r = x - y 4216 if r != -32768 { 4217 t.Errorf("32767 %s -1 = %d, want -32768", "-", r) 4218 } 4219 y = 0 4220 r = x - y 4221 if r != 32767 { 4222 t.Errorf("32767 %s 0 = %d, want 32767", "-", r) 4223 } 4224 y = 1 4225 r = x - y 4226 if r != 32766 { 4227 t.Errorf("32767 %s 1 = %d, want 32766", "-", r) 4228 } 4229 y = 32766 4230 r = x - y 4231 if r != 1 { 4232 t.Errorf("32767 %s 32766 = %d, want 1", "-", r) 4233 } 4234 y = 32767 4235 r = x - y 4236 if r != 0 { 4237 t.Errorf("32767 %s 32767 = %d, want 0", "-", r) 4238 } 4239 } 4240 func TestConstFoldint16div(t *testing.T) { 4241 var x, y, r int16 4242 x = -32768 4243 y = -32768 4244 r = x / y 4245 if r != 1 { 4246 t.Errorf("-32768 %s -32768 = %d, want 1", "/", r) 4247 } 4248 y = -32767 4249 r = x / y 4250 if r != 1 { 4251 t.Errorf("-32768 %s -32767 = %d, want 1", "/", r) 4252 } 4253 y = -1 4254 r = x / y 4255 if r != -32768 { 4256 t.Errorf("-32768 %s -1 = %d, want -32768", "/", r) 4257 } 4258 y = 1 4259 r = x / y 4260 if r != -32768 { 4261 t.Errorf("-32768 %s 1 = %d, want -32768", "/", r) 4262 } 4263 y = 32766 4264 r = x / y 4265 if r != -1 { 4266 t.Errorf("-32768 %s 32766 = %d, want -1", "/", r) 4267 } 4268 y = 32767 4269 r = x / y 4270 if r != -1 { 4271 t.Errorf("-32768 %s 32767 = %d, want -1", "/", r) 4272 } 4273 x = -32767 4274 y = -32768 4275 r = x / y 4276 if r != 0 { 4277 t.Errorf("-32767 %s -32768 = %d, want 0", "/", r) 4278 } 4279 y = -32767 4280 r = x / y 4281 if r != 1 { 4282 t.Errorf("-32767 %s -32767 = %d, want 1", "/", r) 4283 } 4284 y = -1 4285 r = x / y 4286 if r != 32767 { 4287 t.Errorf("-32767 %s -1 = %d, want 32767", "/", r) 4288 } 4289 y = 1 4290 r = x / y 4291 if r != -32767 { 4292 t.Errorf("-32767 %s 1 = %d, want -32767", "/", r) 4293 } 4294 y = 32766 4295 r = x / y 4296 if r != -1 { 4297 t.Errorf("-32767 %s 32766 = %d, want -1", "/", r) 4298 } 4299 y = 32767 4300 r = x / y 4301 if r != -1 { 4302 t.Errorf("-32767 %s 32767 = %d, want -1", "/", r) 4303 } 4304 x = -1 4305 y = -32768 4306 r = x / y 4307 if r != 0 { 4308 t.Errorf("-1 %s -32768 = %d, want 0", "/", r) 4309 } 4310 y = -32767 4311 r = x / y 4312 if r != 0 { 4313 t.Errorf("-1 %s -32767 = %d, want 0", "/", r) 4314 } 4315 y = -1 4316 r = x / y 4317 if r != 1 { 4318 t.Errorf("-1 %s -1 = %d, want 1", "/", r) 4319 } 4320 y = 1 4321 r = x / y 4322 if r != -1 { 4323 t.Errorf("-1 %s 1 = %d, want -1", "/", r) 4324 } 4325 y = 32766 4326 r = x / y 4327 if r != 0 { 4328 t.Errorf("-1 %s 32766 = %d, want 0", "/", r) 4329 } 4330 y = 32767 4331 r = x / y 4332 if r != 0 { 4333 t.Errorf("-1 %s 32767 = %d, want 0", "/", r) 4334 } 4335 x = 0 4336 y = -32768 4337 r = x / y 4338 if r != 0 { 4339 t.Errorf("0 %s -32768 = %d, want 0", "/", r) 4340 } 4341 y = -32767 4342 r = x / y 4343 if r != 0 { 4344 t.Errorf("0 %s -32767 = %d, want 0", "/", r) 4345 } 4346 y = -1 4347 r = x / y 4348 if r != 0 { 4349 t.Errorf("0 %s -1 = %d, want 0", "/", r) 4350 } 4351 y = 1 4352 r = x / y 4353 if r != 0 { 4354 t.Errorf("0 %s 1 = %d, want 0", "/", r) 4355 } 4356 y = 32766 4357 r = x / y 4358 if r != 0 { 4359 t.Errorf("0 %s 32766 = %d, want 0", "/", r) 4360 } 4361 y = 32767 4362 r = x / y 4363 if r != 0 { 4364 t.Errorf("0 %s 32767 = %d, want 0", "/", r) 4365 } 4366 x = 1 4367 y = -32768 4368 r = x / y 4369 if r != 0 { 4370 t.Errorf("1 %s -32768 = %d, want 0", "/", r) 4371 } 4372 y = -32767 4373 r = x / y 4374 if r != 0 { 4375 t.Errorf("1 %s -32767 = %d, want 0", "/", r) 4376 } 4377 y = -1 4378 r = x / y 4379 if r != -1 { 4380 t.Errorf("1 %s -1 = %d, want -1", "/", r) 4381 } 4382 y = 1 4383 r = x / y 4384 if r != 1 { 4385 t.Errorf("1 %s 1 = %d, want 1", "/", r) 4386 } 4387 y = 32766 4388 r = x / y 4389 if r != 0 { 4390 t.Errorf("1 %s 32766 = %d, want 0", "/", r) 4391 } 4392 y = 32767 4393 r = x / y 4394 if r != 0 { 4395 t.Errorf("1 %s 32767 = %d, want 0", "/", r) 4396 } 4397 x = 32766 4398 y = -32768 4399 r = x / y 4400 if r != 0 { 4401 t.Errorf("32766 %s -32768 = %d, want 0", "/", r) 4402 } 4403 y = -32767 4404 r = x / y 4405 if r != 0 { 4406 t.Errorf("32766 %s -32767 = %d, want 0", "/", r) 4407 } 4408 y = -1 4409 r = x / y 4410 if r != -32766 { 4411 t.Errorf("32766 %s -1 = %d, want -32766", "/", r) 4412 } 4413 y = 1 4414 r = x / y 4415 if r != 32766 { 4416 t.Errorf("32766 %s 1 = %d, want 32766", "/", r) 4417 } 4418 y = 32766 4419 r = x / y 4420 if r != 1 { 4421 t.Errorf("32766 %s 32766 = %d, want 1", "/", r) 4422 } 4423 y = 32767 4424 r = x / y 4425 if r != 0 { 4426 t.Errorf("32766 %s 32767 = %d, want 0", "/", r) 4427 } 4428 x = 32767 4429 y = -32768 4430 r = x / y 4431 if r != 0 { 4432 t.Errorf("32767 %s -32768 = %d, want 0", "/", r) 4433 } 4434 y = -32767 4435 r = x / y 4436 if r != -1 { 4437 t.Errorf("32767 %s -32767 = %d, want -1", "/", r) 4438 } 4439 y = -1 4440 r = x / y 4441 if r != -32767 { 4442 t.Errorf("32767 %s -1 = %d, want -32767", "/", r) 4443 } 4444 y = 1 4445 r = x / y 4446 if r != 32767 { 4447 t.Errorf("32767 %s 1 = %d, want 32767", "/", r) 4448 } 4449 y = 32766 4450 r = x / y 4451 if r != 1 { 4452 t.Errorf("32767 %s 32766 = %d, want 1", "/", r) 4453 } 4454 y = 32767 4455 r = x / y 4456 if r != 1 { 4457 t.Errorf("32767 %s 32767 = %d, want 1", "/", r) 4458 } 4459 } 4460 func TestConstFoldint16mul(t *testing.T) { 4461 var x, y, r int16 4462 x = -32768 4463 y = -32768 4464 r = x * y 4465 if r != 0 { 4466 t.Errorf("-32768 %s -32768 = %d, want 0", "*", r) 4467 } 4468 y = -32767 4469 r = x * y 4470 if r != -32768 { 4471 t.Errorf("-32768 %s -32767 = %d, want -32768", "*", r) 4472 } 4473 y = -1 4474 r = x * y 4475 if r != -32768 { 4476 t.Errorf("-32768 %s -1 = %d, want -32768", "*", r) 4477 } 4478 y = 0 4479 r = x * y 4480 if r != 0 { 4481 t.Errorf("-32768 %s 0 = %d, want 0", "*", r) 4482 } 4483 y = 1 4484 r = x * y 4485 if r != -32768 { 4486 t.Errorf("-32768 %s 1 = %d, want -32768", "*", r) 4487 } 4488 y = 32766 4489 r = x * y 4490 if r != 0 { 4491 t.Errorf("-32768 %s 32766 = %d, want 0", "*", r) 4492 } 4493 y = 32767 4494 r = x * y 4495 if r != -32768 { 4496 t.Errorf("-32768 %s 32767 = %d, want -32768", "*", r) 4497 } 4498 x = -32767 4499 y = -32768 4500 r = x * y 4501 if r != -32768 { 4502 t.Errorf("-32767 %s -32768 = %d, want -32768", "*", r) 4503 } 4504 y = -32767 4505 r = x * y 4506 if r != 1 { 4507 t.Errorf("-32767 %s -32767 = %d, want 1", "*", r) 4508 } 4509 y = -1 4510 r = x * y 4511 if r != 32767 { 4512 t.Errorf("-32767 %s -1 = %d, want 32767", "*", r) 4513 } 4514 y = 0 4515 r = x * y 4516 if r != 0 { 4517 t.Errorf("-32767 %s 0 = %d, want 0", "*", r) 4518 } 4519 y = 1 4520 r = x * y 4521 if r != -32767 { 4522 t.Errorf("-32767 %s 1 = %d, want -32767", "*", r) 4523 } 4524 y = 32766 4525 r = x * y 4526 if r != 32766 { 4527 t.Errorf("-32767 %s 32766 = %d, want 32766", "*", r) 4528 } 4529 y = 32767 4530 r = x * y 4531 if r != -1 { 4532 t.Errorf("-32767 %s 32767 = %d, want -1", "*", r) 4533 } 4534 x = -1 4535 y = -32768 4536 r = x * y 4537 if r != -32768 { 4538 t.Errorf("-1 %s -32768 = %d, want -32768", "*", r) 4539 } 4540 y = -32767 4541 r = x * y 4542 if r != 32767 { 4543 t.Errorf("-1 %s -32767 = %d, want 32767", "*", r) 4544 } 4545 y = -1 4546 r = x * y 4547 if r != 1 { 4548 t.Errorf("-1 %s -1 = %d, want 1", "*", r) 4549 } 4550 y = 0 4551 r = x * y 4552 if r != 0 { 4553 t.Errorf("-1 %s 0 = %d, want 0", "*", r) 4554 } 4555 y = 1 4556 r = x * y 4557 if r != -1 { 4558 t.Errorf("-1 %s 1 = %d, want -1", "*", r) 4559 } 4560 y = 32766 4561 r = x * y 4562 if r != -32766 { 4563 t.Errorf("-1 %s 32766 = %d, want -32766", "*", r) 4564 } 4565 y = 32767 4566 r = x * y 4567 if r != -32767 { 4568 t.Errorf("-1 %s 32767 = %d, want -32767", "*", r) 4569 } 4570 x = 0 4571 y = -32768 4572 r = x * y 4573 if r != 0 { 4574 t.Errorf("0 %s -32768 = %d, want 0", "*", r) 4575 } 4576 y = -32767 4577 r = x * y 4578 if r != 0 { 4579 t.Errorf("0 %s -32767 = %d, want 0", "*", r) 4580 } 4581 y = -1 4582 r = x * y 4583 if r != 0 { 4584 t.Errorf("0 %s -1 = %d, want 0", "*", r) 4585 } 4586 y = 0 4587 r = x * y 4588 if r != 0 { 4589 t.Errorf("0 %s 0 = %d, want 0", "*", r) 4590 } 4591 y = 1 4592 r = x * y 4593 if r != 0 { 4594 t.Errorf("0 %s 1 = %d, want 0", "*", r) 4595 } 4596 y = 32766 4597 r = x * y 4598 if r != 0 { 4599 t.Errorf("0 %s 32766 = %d, want 0", "*", r) 4600 } 4601 y = 32767 4602 r = x * y 4603 if r != 0 { 4604 t.Errorf("0 %s 32767 = %d, want 0", "*", r) 4605 } 4606 x = 1 4607 y = -32768 4608 r = x * y 4609 if r != -32768 { 4610 t.Errorf("1 %s -32768 = %d, want -32768", "*", r) 4611 } 4612 y = -32767 4613 r = x * y 4614 if r != -32767 { 4615 t.Errorf("1 %s -32767 = %d, want -32767", "*", r) 4616 } 4617 y = -1 4618 r = x * y 4619 if r != -1 { 4620 t.Errorf("1 %s -1 = %d, want -1", "*", r) 4621 } 4622 y = 0 4623 r = x * y 4624 if r != 0 { 4625 t.Errorf("1 %s 0 = %d, want 0", "*", r) 4626 } 4627 y = 1 4628 r = x * y 4629 if r != 1 { 4630 t.Errorf("1 %s 1 = %d, want 1", "*", r) 4631 } 4632 y = 32766 4633 r = x * y 4634 if r != 32766 { 4635 t.Errorf("1 %s 32766 = %d, want 32766", "*", r) 4636 } 4637 y = 32767 4638 r = x * y 4639 if r != 32767 { 4640 t.Errorf("1 %s 32767 = %d, want 32767", "*", r) 4641 } 4642 x = 32766 4643 y = -32768 4644 r = x * y 4645 if r != 0 { 4646 t.Errorf("32766 %s -32768 = %d, want 0", "*", r) 4647 } 4648 y = -32767 4649 r = x * y 4650 if r != 32766 { 4651 t.Errorf("32766 %s -32767 = %d, want 32766", "*", r) 4652 } 4653 y = -1 4654 r = x * y 4655 if r != -32766 { 4656 t.Errorf("32766 %s -1 = %d, want -32766", "*", r) 4657 } 4658 y = 0 4659 r = x * y 4660 if r != 0 { 4661 t.Errorf("32766 %s 0 = %d, want 0", "*", r) 4662 } 4663 y = 1 4664 r = x * y 4665 if r != 32766 { 4666 t.Errorf("32766 %s 1 = %d, want 32766", "*", r) 4667 } 4668 y = 32766 4669 r = x * y 4670 if r != 4 { 4671 t.Errorf("32766 %s 32766 = %d, want 4", "*", r) 4672 } 4673 y = 32767 4674 r = x * y 4675 if r != -32766 { 4676 t.Errorf("32766 %s 32767 = %d, want -32766", "*", r) 4677 } 4678 x = 32767 4679 y = -32768 4680 r = x * y 4681 if r != -32768 { 4682 t.Errorf("32767 %s -32768 = %d, want -32768", "*", r) 4683 } 4684 y = -32767 4685 r = x * y 4686 if r != -1 { 4687 t.Errorf("32767 %s -32767 = %d, want -1", "*", r) 4688 } 4689 y = -1 4690 r = x * y 4691 if r != -32767 { 4692 t.Errorf("32767 %s -1 = %d, want -32767", "*", r) 4693 } 4694 y = 0 4695 r = x * y 4696 if r != 0 { 4697 t.Errorf("32767 %s 0 = %d, want 0", "*", r) 4698 } 4699 y = 1 4700 r = x * y 4701 if r != 32767 { 4702 t.Errorf("32767 %s 1 = %d, want 32767", "*", r) 4703 } 4704 y = 32766 4705 r = x * y 4706 if r != -32766 { 4707 t.Errorf("32767 %s 32766 = %d, want -32766", "*", r) 4708 } 4709 y = 32767 4710 r = x * y 4711 if r != 1 { 4712 t.Errorf("32767 %s 32767 = %d, want 1", "*", r) 4713 } 4714 } 4715 func TestConstFoldint16mod(t *testing.T) { 4716 var x, y, r int16 4717 x = -32768 4718 y = -32768 4719 r = x % y 4720 if r != 0 { 4721 t.Errorf("-32768 %s -32768 = %d, want 0", "%", r) 4722 } 4723 y = -32767 4724 r = x % y 4725 if r != -1 { 4726 t.Errorf("-32768 %s -32767 = %d, want -1", "%", r) 4727 } 4728 y = -1 4729 r = x % y 4730 if r != 0 { 4731 t.Errorf("-32768 %s -1 = %d, want 0", "%", r) 4732 } 4733 y = 1 4734 r = x % y 4735 if r != 0 { 4736 t.Errorf("-32768 %s 1 = %d, want 0", "%", r) 4737 } 4738 y = 32766 4739 r = x % y 4740 if r != -2 { 4741 t.Errorf("-32768 %s 32766 = %d, want -2", "%", r) 4742 } 4743 y = 32767 4744 r = x % y 4745 if r != -1 { 4746 t.Errorf("-32768 %s 32767 = %d, want -1", "%", r) 4747 } 4748 x = -32767 4749 y = -32768 4750 r = x % y 4751 if r != -32767 { 4752 t.Errorf("-32767 %s -32768 = %d, want -32767", "%", r) 4753 } 4754 y = -32767 4755 r = x % y 4756 if r != 0 { 4757 t.Errorf("-32767 %s -32767 = %d, want 0", "%", r) 4758 } 4759 y = -1 4760 r = x % y 4761 if r != 0 { 4762 t.Errorf("-32767 %s -1 = %d, want 0", "%", r) 4763 } 4764 y = 1 4765 r = x % y 4766 if r != 0 { 4767 t.Errorf("-32767 %s 1 = %d, want 0", "%", r) 4768 } 4769 y = 32766 4770 r = x % y 4771 if r != -1 { 4772 t.Errorf("-32767 %s 32766 = %d, want -1", "%", r) 4773 } 4774 y = 32767 4775 r = x % y 4776 if r != 0 { 4777 t.Errorf("-32767 %s 32767 = %d, want 0", "%", r) 4778 } 4779 x = -1 4780 y = -32768 4781 r = x % y 4782 if r != -1 { 4783 t.Errorf("-1 %s -32768 = %d, want -1", "%", r) 4784 } 4785 y = -32767 4786 r = x % y 4787 if r != -1 { 4788 t.Errorf("-1 %s -32767 = %d, want -1", "%", r) 4789 } 4790 y = -1 4791 r = x % y 4792 if r != 0 { 4793 t.Errorf("-1 %s -1 = %d, want 0", "%", r) 4794 } 4795 y = 1 4796 r = x % y 4797 if r != 0 { 4798 t.Errorf("-1 %s 1 = %d, want 0", "%", r) 4799 } 4800 y = 32766 4801 r = x % y 4802 if r != -1 { 4803 t.Errorf("-1 %s 32766 = %d, want -1", "%", r) 4804 } 4805 y = 32767 4806 r = x % y 4807 if r != -1 { 4808 t.Errorf("-1 %s 32767 = %d, want -1", "%", r) 4809 } 4810 x = 0 4811 y = -32768 4812 r = x % y 4813 if r != 0 { 4814 t.Errorf("0 %s -32768 = %d, want 0", "%", r) 4815 } 4816 y = -32767 4817 r = x % y 4818 if r != 0 { 4819 t.Errorf("0 %s -32767 = %d, want 0", "%", r) 4820 } 4821 y = -1 4822 r = x % y 4823 if r != 0 { 4824 t.Errorf("0 %s -1 = %d, want 0", "%", r) 4825 } 4826 y = 1 4827 r = x % y 4828 if r != 0 { 4829 t.Errorf("0 %s 1 = %d, want 0", "%", r) 4830 } 4831 y = 32766 4832 r = x % y 4833 if r != 0 { 4834 t.Errorf("0 %s 32766 = %d, want 0", "%", r) 4835 } 4836 y = 32767 4837 r = x % y 4838 if r != 0 { 4839 t.Errorf("0 %s 32767 = %d, want 0", "%", r) 4840 } 4841 x = 1 4842 y = -32768 4843 r = x % y 4844 if r != 1 { 4845 t.Errorf("1 %s -32768 = %d, want 1", "%", r) 4846 } 4847 y = -32767 4848 r = x % y 4849 if r != 1 { 4850 t.Errorf("1 %s -32767 = %d, want 1", "%", r) 4851 } 4852 y = -1 4853 r = x % y 4854 if r != 0 { 4855 t.Errorf("1 %s -1 = %d, want 0", "%", r) 4856 } 4857 y = 1 4858 r = x % y 4859 if r != 0 { 4860 t.Errorf("1 %s 1 = %d, want 0", "%", r) 4861 } 4862 y = 32766 4863 r = x % y 4864 if r != 1 { 4865 t.Errorf("1 %s 32766 = %d, want 1", "%", r) 4866 } 4867 y = 32767 4868 r = x % y 4869 if r != 1 { 4870 t.Errorf("1 %s 32767 = %d, want 1", "%", r) 4871 } 4872 x = 32766 4873 y = -32768 4874 r = x % y 4875 if r != 32766 { 4876 t.Errorf("32766 %s -32768 = %d, want 32766", "%", r) 4877 } 4878 y = -32767 4879 r = x % y 4880 if r != 32766 { 4881 t.Errorf("32766 %s -32767 = %d, want 32766", "%", r) 4882 } 4883 y = -1 4884 r = x % y 4885 if r != 0 { 4886 t.Errorf("32766 %s -1 = %d, want 0", "%", r) 4887 } 4888 y = 1 4889 r = x % y 4890 if r != 0 { 4891 t.Errorf("32766 %s 1 = %d, want 0", "%", r) 4892 } 4893 y = 32766 4894 r = x % y 4895 if r != 0 { 4896 t.Errorf("32766 %s 32766 = %d, want 0", "%", r) 4897 } 4898 y = 32767 4899 r = x % y 4900 if r != 32766 { 4901 t.Errorf("32766 %s 32767 = %d, want 32766", "%", r) 4902 } 4903 x = 32767 4904 y = -32768 4905 r = x % y 4906 if r != 32767 { 4907 t.Errorf("32767 %s -32768 = %d, want 32767", "%", r) 4908 } 4909 y = -32767 4910 r = x % y 4911 if r != 0 { 4912 t.Errorf("32767 %s -32767 = %d, want 0", "%", r) 4913 } 4914 y = -1 4915 r = x % y 4916 if r != 0 { 4917 t.Errorf("32767 %s -1 = %d, want 0", "%", r) 4918 } 4919 y = 1 4920 r = x % y 4921 if r != 0 { 4922 t.Errorf("32767 %s 1 = %d, want 0", "%", r) 4923 } 4924 y = 32766 4925 r = x % y 4926 if r != 1 { 4927 t.Errorf("32767 %s 32766 = %d, want 1", "%", r) 4928 } 4929 y = 32767 4930 r = x % y 4931 if r != 0 { 4932 t.Errorf("32767 %s 32767 = %d, want 0", "%", r) 4933 } 4934 } 4935 func TestConstFolduint8add(t *testing.T) { 4936 var x, y, r uint8 4937 x = 0 4938 y = 0 4939 r = x + y 4940 if r != 0 { 4941 t.Errorf("0 %s 0 = %d, want 0", "+", r) 4942 } 4943 y = 1 4944 r = x + y 4945 if r != 1 { 4946 t.Errorf("0 %s 1 = %d, want 1", "+", r) 4947 } 4948 y = 255 4949 r = x + y 4950 if r != 255 { 4951 t.Errorf("0 %s 255 = %d, want 255", "+", r) 4952 } 4953 x = 1 4954 y = 0 4955 r = x + y 4956 if r != 1 { 4957 t.Errorf("1 %s 0 = %d, want 1", "+", r) 4958 } 4959 y = 1 4960 r = x + y 4961 if r != 2 { 4962 t.Errorf("1 %s 1 = %d, want 2", "+", r) 4963 } 4964 y = 255 4965 r = x + y 4966 if r != 0 { 4967 t.Errorf("1 %s 255 = %d, want 0", "+", r) 4968 } 4969 x = 255 4970 y = 0 4971 r = x + y 4972 if r != 255 { 4973 t.Errorf("255 %s 0 = %d, want 255", "+", r) 4974 } 4975 y = 1 4976 r = x + y 4977 if r != 0 { 4978 t.Errorf("255 %s 1 = %d, want 0", "+", r) 4979 } 4980 y = 255 4981 r = x + y 4982 if r != 254 { 4983 t.Errorf("255 %s 255 = %d, want 254", "+", r) 4984 } 4985 } 4986 func TestConstFolduint8sub(t *testing.T) { 4987 var x, y, r uint8 4988 x = 0 4989 y = 0 4990 r = x - y 4991 if r != 0 { 4992 t.Errorf("0 %s 0 = %d, want 0", "-", r) 4993 } 4994 y = 1 4995 r = x - y 4996 if r != 255 { 4997 t.Errorf("0 %s 1 = %d, want 255", "-", r) 4998 } 4999 y = 255 5000 r = x - y 5001 if r != 1 { 5002 t.Errorf("0 %s 255 = %d, want 1", "-", r) 5003 } 5004 x = 1 5005 y = 0 5006 r = x - y 5007 if r != 1 { 5008 t.Errorf("1 %s 0 = %d, want 1", "-", r) 5009 } 5010 y = 1 5011 r = x - y 5012 if r != 0 { 5013 t.Errorf("1 %s 1 = %d, want 0", "-", r) 5014 } 5015 y = 255 5016 r = x - y 5017 if r != 2 { 5018 t.Errorf("1 %s 255 = %d, want 2", "-", r) 5019 } 5020 x = 255 5021 y = 0 5022 r = x - y 5023 if r != 255 { 5024 t.Errorf("255 %s 0 = %d, want 255", "-", r) 5025 } 5026 y = 1 5027 r = x - y 5028 if r != 254 { 5029 t.Errorf("255 %s 1 = %d, want 254", "-", r) 5030 } 5031 y = 255 5032 r = x - y 5033 if r != 0 { 5034 t.Errorf("255 %s 255 = %d, want 0", "-", r) 5035 } 5036 } 5037 func TestConstFolduint8div(t *testing.T) { 5038 var x, y, r uint8 5039 x = 0 5040 y = 1 5041 r = x / y 5042 if r != 0 { 5043 t.Errorf("0 %s 1 = %d, want 0", "/", r) 5044 } 5045 y = 255 5046 r = x / y 5047 if r != 0 { 5048 t.Errorf("0 %s 255 = %d, want 0", "/", r) 5049 } 5050 x = 1 5051 y = 1 5052 r = x / y 5053 if r != 1 { 5054 t.Errorf("1 %s 1 = %d, want 1", "/", r) 5055 } 5056 y = 255 5057 r = x / y 5058 if r != 0 { 5059 t.Errorf("1 %s 255 = %d, want 0", "/", r) 5060 } 5061 x = 255 5062 y = 1 5063 r = x / y 5064 if r != 255 { 5065 t.Errorf("255 %s 1 = %d, want 255", "/", r) 5066 } 5067 y = 255 5068 r = x / y 5069 if r != 1 { 5070 t.Errorf("255 %s 255 = %d, want 1", "/", r) 5071 } 5072 } 5073 func TestConstFolduint8mul(t *testing.T) { 5074 var x, y, r uint8 5075 x = 0 5076 y = 0 5077 r = x * y 5078 if r != 0 { 5079 t.Errorf("0 %s 0 = %d, want 0", "*", r) 5080 } 5081 y = 1 5082 r = x * y 5083 if r != 0 { 5084 t.Errorf("0 %s 1 = %d, want 0", "*", r) 5085 } 5086 y = 255 5087 r = x * y 5088 if r != 0 { 5089 t.Errorf("0 %s 255 = %d, want 0", "*", r) 5090 } 5091 x = 1 5092 y = 0 5093 r = x * y 5094 if r != 0 { 5095 t.Errorf("1 %s 0 = %d, want 0", "*", r) 5096 } 5097 y = 1 5098 r = x * y 5099 if r != 1 { 5100 t.Errorf("1 %s 1 = %d, want 1", "*", r) 5101 } 5102 y = 255 5103 r = x * y 5104 if r != 255 { 5105 t.Errorf("1 %s 255 = %d, want 255", "*", r) 5106 } 5107 x = 255 5108 y = 0 5109 r = x * y 5110 if r != 0 { 5111 t.Errorf("255 %s 0 = %d, want 0", "*", r) 5112 } 5113 y = 1 5114 r = x * y 5115 if r != 255 { 5116 t.Errorf("255 %s 1 = %d, want 255", "*", r) 5117 } 5118 y = 255 5119 r = x * y 5120 if r != 1 { 5121 t.Errorf("255 %s 255 = %d, want 1", "*", r) 5122 } 5123 } 5124 func TestConstFolduint8mod(t *testing.T) { 5125 var x, y, r uint8 5126 x = 0 5127 y = 1 5128 r = x % y 5129 if r != 0 { 5130 t.Errorf("0 %s 1 = %d, want 0", "%", r) 5131 } 5132 y = 255 5133 r = x % y 5134 if r != 0 { 5135 t.Errorf("0 %s 255 = %d, want 0", "%", r) 5136 } 5137 x = 1 5138 y = 1 5139 r = x % y 5140 if r != 0 { 5141 t.Errorf("1 %s 1 = %d, want 0", "%", r) 5142 } 5143 y = 255 5144 r = x % y 5145 if r != 1 { 5146 t.Errorf("1 %s 255 = %d, want 1", "%", r) 5147 } 5148 x = 255 5149 y = 1 5150 r = x % y 5151 if r != 0 { 5152 t.Errorf("255 %s 1 = %d, want 0", "%", r) 5153 } 5154 y = 255 5155 r = x % y 5156 if r != 0 { 5157 t.Errorf("255 %s 255 = %d, want 0", "%", r) 5158 } 5159 } 5160 func TestConstFoldint8add(t *testing.T) { 5161 var x, y, r int8 5162 x = -128 5163 y = -128 5164 r = x + y 5165 if r != 0 { 5166 t.Errorf("-128 %s -128 = %d, want 0", "+", r) 5167 } 5168 y = -127 5169 r = x + y 5170 if r != 1 { 5171 t.Errorf("-128 %s -127 = %d, want 1", "+", r) 5172 } 5173 y = -1 5174 r = x + y 5175 if r != 127 { 5176 t.Errorf("-128 %s -1 = %d, want 127", "+", r) 5177 } 5178 y = 0 5179 r = x + y 5180 if r != -128 { 5181 t.Errorf("-128 %s 0 = %d, want -128", "+", r) 5182 } 5183 y = 1 5184 r = x + y 5185 if r != -127 { 5186 t.Errorf("-128 %s 1 = %d, want -127", "+", r) 5187 } 5188 y = 126 5189 r = x + y 5190 if r != -2 { 5191 t.Errorf("-128 %s 126 = %d, want -2", "+", r) 5192 } 5193 y = 127 5194 r = x + y 5195 if r != -1 { 5196 t.Errorf("-128 %s 127 = %d, want -1", "+", r) 5197 } 5198 x = -127 5199 y = -128 5200 r = x + y 5201 if r != 1 { 5202 t.Errorf("-127 %s -128 = %d, want 1", "+", r) 5203 } 5204 y = -127 5205 r = x + y 5206 if r != 2 { 5207 t.Errorf("-127 %s -127 = %d, want 2", "+", r) 5208 } 5209 y = -1 5210 r = x + y 5211 if r != -128 { 5212 t.Errorf("-127 %s -1 = %d, want -128", "+", r) 5213 } 5214 y = 0 5215 r = x + y 5216 if r != -127 { 5217 t.Errorf("-127 %s 0 = %d, want -127", "+", r) 5218 } 5219 y = 1 5220 r = x + y 5221 if r != -126 { 5222 t.Errorf("-127 %s 1 = %d, want -126", "+", r) 5223 } 5224 y = 126 5225 r = x + y 5226 if r != -1 { 5227 t.Errorf("-127 %s 126 = %d, want -1", "+", r) 5228 } 5229 y = 127 5230 r = x + y 5231 if r != 0 { 5232 t.Errorf("-127 %s 127 = %d, want 0", "+", r) 5233 } 5234 x = -1 5235 y = -128 5236 r = x + y 5237 if r != 127 { 5238 t.Errorf("-1 %s -128 = %d, want 127", "+", r) 5239 } 5240 y = -127 5241 r = x + y 5242 if r != -128 { 5243 t.Errorf("-1 %s -127 = %d, want -128", "+", r) 5244 } 5245 y = -1 5246 r = x + y 5247 if r != -2 { 5248 t.Errorf("-1 %s -1 = %d, want -2", "+", r) 5249 } 5250 y = 0 5251 r = x + y 5252 if r != -1 { 5253 t.Errorf("-1 %s 0 = %d, want -1", "+", r) 5254 } 5255 y = 1 5256 r = x + y 5257 if r != 0 { 5258 t.Errorf("-1 %s 1 = %d, want 0", "+", r) 5259 } 5260 y = 126 5261 r = x + y 5262 if r != 125 { 5263 t.Errorf("-1 %s 126 = %d, want 125", "+", r) 5264 } 5265 y = 127 5266 r = x + y 5267 if r != 126 { 5268 t.Errorf("-1 %s 127 = %d, want 126", "+", r) 5269 } 5270 x = 0 5271 y = -128 5272 r = x + y 5273 if r != -128 { 5274 t.Errorf("0 %s -128 = %d, want -128", "+", r) 5275 } 5276 y = -127 5277 r = x + y 5278 if r != -127 { 5279 t.Errorf("0 %s -127 = %d, want -127", "+", r) 5280 } 5281 y = -1 5282 r = x + y 5283 if r != -1 { 5284 t.Errorf("0 %s -1 = %d, want -1", "+", r) 5285 } 5286 y = 0 5287 r = x + y 5288 if r != 0 { 5289 t.Errorf("0 %s 0 = %d, want 0", "+", r) 5290 } 5291 y = 1 5292 r = x + y 5293 if r != 1 { 5294 t.Errorf("0 %s 1 = %d, want 1", "+", r) 5295 } 5296 y = 126 5297 r = x + y 5298 if r != 126 { 5299 t.Errorf("0 %s 126 = %d, want 126", "+", r) 5300 } 5301 y = 127 5302 r = x + y 5303 if r != 127 { 5304 t.Errorf("0 %s 127 = %d, want 127", "+", r) 5305 } 5306 x = 1 5307 y = -128 5308 r = x + y 5309 if r != -127 { 5310 t.Errorf("1 %s -128 = %d, want -127", "+", r) 5311 } 5312 y = -127 5313 r = x + y 5314 if r != -126 { 5315 t.Errorf("1 %s -127 = %d, want -126", "+", r) 5316 } 5317 y = -1 5318 r = x + y 5319 if r != 0 { 5320 t.Errorf("1 %s -1 = %d, want 0", "+", r) 5321 } 5322 y = 0 5323 r = x + y 5324 if r != 1 { 5325 t.Errorf("1 %s 0 = %d, want 1", "+", r) 5326 } 5327 y = 1 5328 r = x + y 5329 if r != 2 { 5330 t.Errorf("1 %s 1 = %d, want 2", "+", r) 5331 } 5332 y = 126 5333 r = x + y 5334 if r != 127 { 5335 t.Errorf("1 %s 126 = %d, want 127", "+", r) 5336 } 5337 y = 127 5338 r = x + y 5339 if r != -128 { 5340 t.Errorf("1 %s 127 = %d, want -128", "+", r) 5341 } 5342 x = 126 5343 y = -128 5344 r = x + y 5345 if r != -2 { 5346 t.Errorf("126 %s -128 = %d, want -2", "+", r) 5347 } 5348 y = -127 5349 r = x + y 5350 if r != -1 { 5351 t.Errorf("126 %s -127 = %d, want -1", "+", r) 5352 } 5353 y = -1 5354 r = x + y 5355 if r != 125 { 5356 t.Errorf("126 %s -1 = %d, want 125", "+", r) 5357 } 5358 y = 0 5359 r = x + y 5360 if r != 126 { 5361 t.Errorf("126 %s 0 = %d, want 126", "+", r) 5362 } 5363 y = 1 5364 r = x + y 5365 if r != 127 { 5366 t.Errorf("126 %s 1 = %d, want 127", "+", r) 5367 } 5368 y = 126 5369 r = x + y 5370 if r != -4 { 5371 t.Errorf("126 %s 126 = %d, want -4", "+", r) 5372 } 5373 y = 127 5374 r = x + y 5375 if r != -3 { 5376 t.Errorf("126 %s 127 = %d, want -3", "+", r) 5377 } 5378 x = 127 5379 y = -128 5380 r = x + y 5381 if r != -1 { 5382 t.Errorf("127 %s -128 = %d, want -1", "+", r) 5383 } 5384 y = -127 5385 r = x + y 5386 if r != 0 { 5387 t.Errorf("127 %s -127 = %d, want 0", "+", r) 5388 } 5389 y = -1 5390 r = x + y 5391 if r != 126 { 5392 t.Errorf("127 %s -1 = %d, want 126", "+", r) 5393 } 5394 y = 0 5395 r = x + y 5396 if r != 127 { 5397 t.Errorf("127 %s 0 = %d, want 127", "+", r) 5398 } 5399 y = 1 5400 r = x + y 5401 if r != -128 { 5402 t.Errorf("127 %s 1 = %d, want -128", "+", r) 5403 } 5404 y = 126 5405 r = x + y 5406 if r != -3 { 5407 t.Errorf("127 %s 126 = %d, want -3", "+", r) 5408 } 5409 y = 127 5410 r = x + y 5411 if r != -2 { 5412 t.Errorf("127 %s 127 = %d, want -2", "+", r) 5413 } 5414 } 5415 func TestConstFoldint8sub(t *testing.T) { 5416 var x, y, r int8 5417 x = -128 5418 y = -128 5419 r = x - y 5420 if r != 0 { 5421 t.Errorf("-128 %s -128 = %d, want 0", "-", r) 5422 } 5423 y = -127 5424 r = x - y 5425 if r != -1 { 5426 t.Errorf("-128 %s -127 = %d, want -1", "-", r) 5427 } 5428 y = -1 5429 r = x - y 5430 if r != -127 { 5431 t.Errorf("-128 %s -1 = %d, want -127", "-", r) 5432 } 5433 y = 0 5434 r = x - y 5435 if r != -128 { 5436 t.Errorf("-128 %s 0 = %d, want -128", "-", r) 5437 } 5438 y = 1 5439 r = x - y 5440 if r != 127 { 5441 t.Errorf("-128 %s 1 = %d, want 127", "-", r) 5442 } 5443 y = 126 5444 r = x - y 5445 if r != 2 { 5446 t.Errorf("-128 %s 126 = %d, want 2", "-", r) 5447 } 5448 y = 127 5449 r = x - y 5450 if r != 1 { 5451 t.Errorf("-128 %s 127 = %d, want 1", "-", r) 5452 } 5453 x = -127 5454 y = -128 5455 r = x - y 5456 if r != 1 { 5457 t.Errorf("-127 %s -128 = %d, want 1", "-", r) 5458 } 5459 y = -127 5460 r = x - y 5461 if r != 0 { 5462 t.Errorf("-127 %s -127 = %d, want 0", "-", r) 5463 } 5464 y = -1 5465 r = x - y 5466 if r != -126 { 5467 t.Errorf("-127 %s -1 = %d, want -126", "-", r) 5468 } 5469 y = 0 5470 r = x - y 5471 if r != -127 { 5472 t.Errorf("-127 %s 0 = %d, want -127", "-", r) 5473 } 5474 y = 1 5475 r = x - y 5476 if r != -128 { 5477 t.Errorf("-127 %s 1 = %d, want -128", "-", r) 5478 } 5479 y = 126 5480 r = x - y 5481 if r != 3 { 5482 t.Errorf("-127 %s 126 = %d, want 3", "-", r) 5483 } 5484 y = 127 5485 r = x - y 5486 if r != 2 { 5487 t.Errorf("-127 %s 127 = %d, want 2", "-", r) 5488 } 5489 x = -1 5490 y = -128 5491 r = x - y 5492 if r != 127 { 5493 t.Errorf("-1 %s -128 = %d, want 127", "-", r) 5494 } 5495 y = -127 5496 r = x - y 5497 if r != 126 { 5498 t.Errorf("-1 %s -127 = %d, want 126", "-", r) 5499 } 5500 y = -1 5501 r = x - y 5502 if r != 0 { 5503 t.Errorf("-1 %s -1 = %d, want 0", "-", r) 5504 } 5505 y = 0 5506 r = x - y 5507 if r != -1 { 5508 t.Errorf("-1 %s 0 = %d, want -1", "-", r) 5509 } 5510 y = 1 5511 r = x - y 5512 if r != -2 { 5513 t.Errorf("-1 %s 1 = %d, want -2", "-", r) 5514 } 5515 y = 126 5516 r = x - y 5517 if r != -127 { 5518 t.Errorf("-1 %s 126 = %d, want -127", "-", r) 5519 } 5520 y = 127 5521 r = x - y 5522 if r != -128 { 5523 t.Errorf("-1 %s 127 = %d, want -128", "-", r) 5524 } 5525 x = 0 5526 y = -128 5527 r = x - y 5528 if r != -128 { 5529 t.Errorf("0 %s -128 = %d, want -128", "-", r) 5530 } 5531 y = -127 5532 r = x - y 5533 if r != 127 { 5534 t.Errorf("0 %s -127 = %d, want 127", "-", r) 5535 } 5536 y = -1 5537 r = x - y 5538 if r != 1 { 5539 t.Errorf("0 %s -1 = %d, want 1", "-", r) 5540 } 5541 y = 0 5542 r = x - y 5543 if r != 0 { 5544 t.Errorf("0 %s 0 = %d, want 0", "-", r) 5545 } 5546 y = 1 5547 r = x - y 5548 if r != -1 { 5549 t.Errorf("0 %s 1 = %d, want -1", "-", r) 5550 } 5551 y = 126 5552 r = x - y 5553 if r != -126 { 5554 t.Errorf("0 %s 126 = %d, want -126", "-", r) 5555 } 5556 y = 127 5557 r = x - y 5558 if r != -127 { 5559 t.Errorf("0 %s 127 = %d, want -127", "-", r) 5560 } 5561 x = 1 5562 y = -128 5563 r = x - y 5564 if r != -127 { 5565 t.Errorf("1 %s -128 = %d, want -127", "-", r) 5566 } 5567 y = -127 5568 r = x - y 5569 if r != -128 { 5570 t.Errorf("1 %s -127 = %d, want -128", "-", r) 5571 } 5572 y = -1 5573 r = x - y 5574 if r != 2 { 5575 t.Errorf("1 %s -1 = %d, want 2", "-", r) 5576 } 5577 y = 0 5578 r = x - y 5579 if r != 1 { 5580 t.Errorf("1 %s 0 = %d, want 1", "-", r) 5581 } 5582 y = 1 5583 r = x - y 5584 if r != 0 { 5585 t.Errorf("1 %s 1 = %d, want 0", "-", r) 5586 } 5587 y = 126 5588 r = x - y 5589 if r != -125 { 5590 t.Errorf("1 %s 126 = %d, want -125", "-", r) 5591 } 5592 y = 127 5593 r = x - y 5594 if r != -126 { 5595 t.Errorf("1 %s 127 = %d, want -126", "-", r) 5596 } 5597 x = 126 5598 y = -128 5599 r = x - y 5600 if r != -2 { 5601 t.Errorf("126 %s -128 = %d, want -2", "-", r) 5602 } 5603 y = -127 5604 r = x - y 5605 if r != -3 { 5606 t.Errorf("126 %s -127 = %d, want -3", "-", r) 5607 } 5608 y = -1 5609 r = x - y 5610 if r != 127 { 5611 t.Errorf("126 %s -1 = %d, want 127", "-", r) 5612 } 5613 y = 0 5614 r = x - y 5615 if r != 126 { 5616 t.Errorf("126 %s 0 = %d, want 126", "-", r) 5617 } 5618 y = 1 5619 r = x - y 5620 if r != 125 { 5621 t.Errorf("126 %s 1 = %d, want 125", "-", r) 5622 } 5623 y = 126 5624 r = x - y 5625 if r != 0 { 5626 t.Errorf("126 %s 126 = %d, want 0", "-", r) 5627 } 5628 y = 127 5629 r = x - y 5630 if r != -1 { 5631 t.Errorf("126 %s 127 = %d, want -1", "-", r) 5632 } 5633 x = 127 5634 y = -128 5635 r = x - y 5636 if r != -1 { 5637 t.Errorf("127 %s -128 = %d, want -1", "-", r) 5638 } 5639 y = -127 5640 r = x - y 5641 if r != -2 { 5642 t.Errorf("127 %s -127 = %d, want -2", "-", r) 5643 } 5644 y = -1 5645 r = x - y 5646 if r != -128 { 5647 t.Errorf("127 %s -1 = %d, want -128", "-", r) 5648 } 5649 y = 0 5650 r = x - y 5651 if r != 127 { 5652 t.Errorf("127 %s 0 = %d, want 127", "-", r) 5653 } 5654 y = 1 5655 r = x - y 5656 if r != 126 { 5657 t.Errorf("127 %s 1 = %d, want 126", "-", r) 5658 } 5659 y = 126 5660 r = x - y 5661 if r != 1 { 5662 t.Errorf("127 %s 126 = %d, want 1", "-", r) 5663 } 5664 y = 127 5665 r = x - y 5666 if r != 0 { 5667 t.Errorf("127 %s 127 = %d, want 0", "-", r) 5668 } 5669 } 5670 func TestConstFoldint8div(t *testing.T) { 5671 var x, y, r int8 5672 x = -128 5673 y = -128 5674 r = x / y 5675 if r != 1 { 5676 t.Errorf("-128 %s -128 = %d, want 1", "/", r) 5677 } 5678 y = -127 5679 r = x / y 5680 if r != 1 { 5681 t.Errorf("-128 %s -127 = %d, want 1", "/", r) 5682 } 5683 y = -1 5684 r = x / y 5685 if r != -128 { 5686 t.Errorf("-128 %s -1 = %d, want -128", "/", r) 5687 } 5688 y = 1 5689 r = x / y 5690 if r != -128 { 5691 t.Errorf("-128 %s 1 = %d, want -128", "/", r) 5692 } 5693 y = 126 5694 r = x / y 5695 if r != -1 { 5696 t.Errorf("-128 %s 126 = %d, want -1", "/", r) 5697 } 5698 y = 127 5699 r = x / y 5700 if r != -1 { 5701 t.Errorf("-128 %s 127 = %d, want -1", "/", r) 5702 } 5703 x = -127 5704 y = -128 5705 r = x / y 5706 if r != 0 { 5707 t.Errorf("-127 %s -128 = %d, want 0", "/", r) 5708 } 5709 y = -127 5710 r = x / y 5711 if r != 1 { 5712 t.Errorf("-127 %s -127 = %d, want 1", "/", r) 5713 } 5714 y = -1 5715 r = x / y 5716 if r != 127 { 5717 t.Errorf("-127 %s -1 = %d, want 127", "/", r) 5718 } 5719 y = 1 5720 r = x / y 5721 if r != -127 { 5722 t.Errorf("-127 %s 1 = %d, want -127", "/", r) 5723 } 5724 y = 126 5725 r = x / y 5726 if r != -1 { 5727 t.Errorf("-127 %s 126 = %d, want -1", "/", r) 5728 } 5729 y = 127 5730 r = x / y 5731 if r != -1 { 5732 t.Errorf("-127 %s 127 = %d, want -1", "/", r) 5733 } 5734 x = -1 5735 y = -128 5736 r = x / y 5737 if r != 0 { 5738 t.Errorf("-1 %s -128 = %d, want 0", "/", r) 5739 } 5740 y = -127 5741 r = x / y 5742 if r != 0 { 5743 t.Errorf("-1 %s -127 = %d, want 0", "/", r) 5744 } 5745 y = -1 5746 r = x / y 5747 if r != 1 { 5748 t.Errorf("-1 %s -1 = %d, want 1", "/", r) 5749 } 5750 y = 1 5751 r = x / y 5752 if r != -1 { 5753 t.Errorf("-1 %s 1 = %d, want -1", "/", r) 5754 } 5755 y = 126 5756 r = x / y 5757 if r != 0 { 5758 t.Errorf("-1 %s 126 = %d, want 0", "/", r) 5759 } 5760 y = 127 5761 r = x / y 5762 if r != 0 { 5763 t.Errorf("-1 %s 127 = %d, want 0", "/", r) 5764 } 5765 x = 0 5766 y = -128 5767 r = x / y 5768 if r != 0 { 5769 t.Errorf("0 %s -128 = %d, want 0", "/", r) 5770 } 5771 y = -127 5772 r = x / y 5773 if r != 0 { 5774 t.Errorf("0 %s -127 = %d, want 0", "/", r) 5775 } 5776 y = -1 5777 r = x / y 5778 if r != 0 { 5779 t.Errorf("0 %s -1 = %d, want 0", "/", r) 5780 } 5781 y = 1 5782 r = x / y 5783 if r != 0 { 5784 t.Errorf("0 %s 1 = %d, want 0", "/", r) 5785 } 5786 y = 126 5787 r = x / y 5788 if r != 0 { 5789 t.Errorf("0 %s 126 = %d, want 0", "/", r) 5790 } 5791 y = 127 5792 r = x / y 5793 if r != 0 { 5794 t.Errorf("0 %s 127 = %d, want 0", "/", r) 5795 } 5796 x = 1 5797 y = -128 5798 r = x / y 5799 if r != 0 { 5800 t.Errorf("1 %s -128 = %d, want 0", "/", r) 5801 } 5802 y = -127 5803 r = x / y 5804 if r != 0 { 5805 t.Errorf("1 %s -127 = %d, want 0", "/", r) 5806 } 5807 y = -1 5808 r = x / y 5809 if r != -1 { 5810 t.Errorf("1 %s -1 = %d, want -1", "/", r) 5811 } 5812 y = 1 5813 r = x / y 5814 if r != 1 { 5815 t.Errorf("1 %s 1 = %d, want 1", "/", r) 5816 } 5817 y = 126 5818 r = x / y 5819 if r != 0 { 5820 t.Errorf("1 %s 126 = %d, want 0", "/", r) 5821 } 5822 y = 127 5823 r = x / y 5824 if r != 0 { 5825 t.Errorf("1 %s 127 = %d, want 0", "/", r) 5826 } 5827 x = 126 5828 y = -128 5829 r = x / y 5830 if r != 0 { 5831 t.Errorf("126 %s -128 = %d, want 0", "/", r) 5832 } 5833 y = -127 5834 r = x / y 5835 if r != 0 { 5836 t.Errorf("126 %s -127 = %d, want 0", "/", r) 5837 } 5838 y = -1 5839 r = x / y 5840 if r != -126 { 5841 t.Errorf("126 %s -1 = %d, want -126", "/", r) 5842 } 5843 y = 1 5844 r = x / y 5845 if r != 126 { 5846 t.Errorf("126 %s 1 = %d, want 126", "/", r) 5847 } 5848 y = 126 5849 r = x / y 5850 if r != 1 { 5851 t.Errorf("126 %s 126 = %d, want 1", "/", r) 5852 } 5853 y = 127 5854 r = x / y 5855 if r != 0 { 5856 t.Errorf("126 %s 127 = %d, want 0", "/", r) 5857 } 5858 x = 127 5859 y = -128 5860 r = x / y 5861 if r != 0 { 5862 t.Errorf("127 %s -128 = %d, want 0", "/", r) 5863 } 5864 y = -127 5865 r = x / y 5866 if r != -1 { 5867 t.Errorf("127 %s -127 = %d, want -1", "/", r) 5868 } 5869 y = -1 5870 r = x / y 5871 if r != -127 { 5872 t.Errorf("127 %s -1 = %d, want -127", "/", r) 5873 } 5874 y = 1 5875 r = x / y 5876 if r != 127 { 5877 t.Errorf("127 %s 1 = %d, want 127", "/", r) 5878 } 5879 y = 126 5880 r = x / y 5881 if r != 1 { 5882 t.Errorf("127 %s 126 = %d, want 1", "/", r) 5883 } 5884 y = 127 5885 r = x / y 5886 if r != 1 { 5887 t.Errorf("127 %s 127 = %d, want 1", "/", r) 5888 } 5889 } 5890 func TestConstFoldint8mul(t *testing.T) { 5891 var x, y, r int8 5892 x = -128 5893 y = -128 5894 r = x * y 5895 if r != 0 { 5896 t.Errorf("-128 %s -128 = %d, want 0", "*", r) 5897 } 5898 y = -127 5899 r = x * y 5900 if r != -128 { 5901 t.Errorf("-128 %s -127 = %d, want -128", "*", r) 5902 } 5903 y = -1 5904 r = x * y 5905 if r != -128 { 5906 t.Errorf("-128 %s -1 = %d, want -128", "*", r) 5907 } 5908 y = 0 5909 r = x * y 5910 if r != 0 { 5911 t.Errorf("-128 %s 0 = %d, want 0", "*", r) 5912 } 5913 y = 1 5914 r = x * y 5915 if r != -128 { 5916 t.Errorf("-128 %s 1 = %d, want -128", "*", r) 5917 } 5918 y = 126 5919 r = x * y 5920 if r != 0 { 5921 t.Errorf("-128 %s 126 = %d, want 0", "*", r) 5922 } 5923 y = 127 5924 r = x * y 5925 if r != -128 { 5926 t.Errorf("-128 %s 127 = %d, want -128", "*", r) 5927 } 5928 x = -127 5929 y = -128 5930 r = x * y 5931 if r != -128 { 5932 t.Errorf("-127 %s -128 = %d, want -128", "*", r) 5933 } 5934 y = -127 5935 r = x * y 5936 if r != 1 { 5937 t.Errorf("-127 %s -127 = %d, want 1", "*", r) 5938 } 5939 y = -1 5940 r = x * y 5941 if r != 127 { 5942 t.Errorf("-127 %s -1 = %d, want 127", "*", r) 5943 } 5944 y = 0 5945 r = x * y 5946 if r != 0 { 5947 t.Errorf("-127 %s 0 = %d, want 0", "*", r) 5948 } 5949 y = 1 5950 r = x * y 5951 if r != -127 { 5952 t.Errorf("-127 %s 1 = %d, want -127", "*", r) 5953 } 5954 y = 126 5955 r = x * y 5956 if r != 126 { 5957 t.Errorf("-127 %s 126 = %d, want 126", "*", r) 5958 } 5959 y = 127 5960 r = x * y 5961 if r != -1 { 5962 t.Errorf("-127 %s 127 = %d, want -1", "*", r) 5963 } 5964 x = -1 5965 y = -128 5966 r = x * y 5967 if r != -128 { 5968 t.Errorf("-1 %s -128 = %d, want -128", "*", r) 5969 } 5970 y = -127 5971 r = x * y 5972 if r != 127 { 5973 t.Errorf("-1 %s -127 = %d, want 127", "*", r) 5974 } 5975 y = -1 5976 r = x * y 5977 if r != 1 { 5978 t.Errorf("-1 %s -1 = %d, want 1", "*", r) 5979 } 5980 y = 0 5981 r = x * y 5982 if r != 0 { 5983 t.Errorf("-1 %s 0 = %d, want 0", "*", r) 5984 } 5985 y = 1 5986 r = x * y 5987 if r != -1 { 5988 t.Errorf("-1 %s 1 = %d, want -1", "*", r) 5989 } 5990 y = 126 5991 r = x * y 5992 if r != -126 { 5993 t.Errorf("-1 %s 126 = %d, want -126", "*", r) 5994 } 5995 y = 127 5996 r = x * y 5997 if r != -127 { 5998 t.Errorf("-1 %s 127 = %d, want -127", "*", r) 5999 } 6000 x = 0 6001 y = -128 6002 r = x * y 6003 if r != 0 { 6004 t.Errorf("0 %s -128 = %d, want 0", "*", r) 6005 } 6006 y = -127 6007 r = x * y 6008 if r != 0 { 6009 t.Errorf("0 %s -127 = %d, want 0", "*", r) 6010 } 6011 y = -1 6012 r = x * y 6013 if r != 0 { 6014 t.Errorf("0 %s -1 = %d, want 0", "*", r) 6015 } 6016 y = 0 6017 r = x * y 6018 if r != 0 { 6019 t.Errorf("0 %s 0 = %d, want 0", "*", r) 6020 } 6021 y = 1 6022 r = x * y 6023 if r != 0 { 6024 t.Errorf("0 %s 1 = %d, want 0", "*", r) 6025 } 6026 y = 126 6027 r = x * y 6028 if r != 0 { 6029 t.Errorf("0 %s 126 = %d, want 0", "*", r) 6030 } 6031 y = 127 6032 r = x * y 6033 if r != 0 { 6034 t.Errorf("0 %s 127 = %d, want 0", "*", r) 6035 } 6036 x = 1 6037 y = -128 6038 r = x * y 6039 if r != -128 { 6040 t.Errorf("1 %s -128 = %d, want -128", "*", r) 6041 } 6042 y = -127 6043 r = x * y 6044 if r != -127 { 6045 t.Errorf("1 %s -127 = %d, want -127", "*", r) 6046 } 6047 y = -1 6048 r = x * y 6049 if r != -1 { 6050 t.Errorf("1 %s -1 = %d, want -1", "*", r) 6051 } 6052 y = 0 6053 r = x * y 6054 if r != 0 { 6055 t.Errorf("1 %s 0 = %d, want 0", "*", r) 6056 } 6057 y = 1 6058 r = x * y 6059 if r != 1 { 6060 t.Errorf("1 %s 1 = %d, want 1", "*", r) 6061 } 6062 y = 126 6063 r = x * y 6064 if r != 126 { 6065 t.Errorf("1 %s 126 = %d, want 126", "*", r) 6066 } 6067 y = 127 6068 r = x * y 6069 if r != 127 { 6070 t.Errorf("1 %s 127 = %d, want 127", "*", r) 6071 } 6072 x = 126 6073 y = -128 6074 r = x * y 6075 if r != 0 { 6076 t.Errorf("126 %s -128 = %d, want 0", "*", r) 6077 } 6078 y = -127 6079 r = x * y 6080 if r != 126 { 6081 t.Errorf("126 %s -127 = %d, want 126", "*", r) 6082 } 6083 y = -1 6084 r = x * y 6085 if r != -126 { 6086 t.Errorf("126 %s -1 = %d, want -126", "*", r) 6087 } 6088 y = 0 6089 r = x * y 6090 if r != 0 { 6091 t.Errorf("126 %s 0 = %d, want 0", "*", r) 6092 } 6093 y = 1 6094 r = x * y 6095 if r != 126 { 6096 t.Errorf("126 %s 1 = %d, want 126", "*", r) 6097 } 6098 y = 126 6099 r = x * y 6100 if r != 4 { 6101 t.Errorf("126 %s 126 = %d, want 4", "*", r) 6102 } 6103 y = 127 6104 r = x * y 6105 if r != -126 { 6106 t.Errorf("126 %s 127 = %d, want -126", "*", r) 6107 } 6108 x = 127 6109 y = -128 6110 r = x * y 6111 if r != -128 { 6112 t.Errorf("127 %s -128 = %d, want -128", "*", r) 6113 } 6114 y = -127 6115 r = x * y 6116 if r != -1 { 6117 t.Errorf("127 %s -127 = %d, want -1", "*", r) 6118 } 6119 y = -1 6120 r = x * y 6121 if r != -127 { 6122 t.Errorf("127 %s -1 = %d, want -127", "*", r) 6123 } 6124 y = 0 6125 r = x * y 6126 if r != 0 { 6127 t.Errorf("127 %s 0 = %d, want 0", "*", r) 6128 } 6129 y = 1 6130 r = x * y 6131 if r != 127 { 6132 t.Errorf("127 %s 1 = %d, want 127", "*", r) 6133 } 6134 y = 126 6135 r = x * y 6136 if r != -126 { 6137 t.Errorf("127 %s 126 = %d, want -126", "*", r) 6138 } 6139 y = 127 6140 r = x * y 6141 if r != 1 { 6142 t.Errorf("127 %s 127 = %d, want 1", "*", r) 6143 } 6144 } 6145 func TestConstFoldint8mod(t *testing.T) { 6146 var x, y, r int8 6147 x = -128 6148 y = -128 6149 r = x % y 6150 if r != 0 { 6151 t.Errorf("-128 %s -128 = %d, want 0", "%", r) 6152 } 6153 y = -127 6154 r = x % y 6155 if r != -1 { 6156 t.Errorf("-128 %s -127 = %d, want -1", "%", r) 6157 } 6158 y = -1 6159 r = x % y 6160 if r != 0 { 6161 t.Errorf("-128 %s -1 = %d, want 0", "%", r) 6162 } 6163 y = 1 6164 r = x % y 6165 if r != 0 { 6166 t.Errorf("-128 %s 1 = %d, want 0", "%", r) 6167 } 6168 y = 126 6169 r = x % y 6170 if r != -2 { 6171 t.Errorf("-128 %s 126 = %d, want -2", "%", r) 6172 } 6173 y = 127 6174 r = x % y 6175 if r != -1 { 6176 t.Errorf("-128 %s 127 = %d, want -1", "%", r) 6177 } 6178 x = -127 6179 y = -128 6180 r = x % y 6181 if r != -127 { 6182 t.Errorf("-127 %s -128 = %d, want -127", "%", r) 6183 } 6184 y = -127 6185 r = x % y 6186 if r != 0 { 6187 t.Errorf("-127 %s -127 = %d, want 0", "%", r) 6188 } 6189 y = -1 6190 r = x % y 6191 if r != 0 { 6192 t.Errorf("-127 %s -1 = %d, want 0", "%", r) 6193 } 6194 y = 1 6195 r = x % y 6196 if r != 0 { 6197 t.Errorf("-127 %s 1 = %d, want 0", "%", r) 6198 } 6199 y = 126 6200 r = x % y 6201 if r != -1 { 6202 t.Errorf("-127 %s 126 = %d, want -1", "%", r) 6203 } 6204 y = 127 6205 r = x % y 6206 if r != 0 { 6207 t.Errorf("-127 %s 127 = %d, want 0", "%", r) 6208 } 6209 x = -1 6210 y = -128 6211 r = x % y 6212 if r != -1 { 6213 t.Errorf("-1 %s -128 = %d, want -1", "%", r) 6214 } 6215 y = -127 6216 r = x % y 6217 if r != -1 { 6218 t.Errorf("-1 %s -127 = %d, want -1", "%", r) 6219 } 6220 y = -1 6221 r = x % y 6222 if r != 0 { 6223 t.Errorf("-1 %s -1 = %d, want 0", "%", r) 6224 } 6225 y = 1 6226 r = x % y 6227 if r != 0 { 6228 t.Errorf("-1 %s 1 = %d, want 0", "%", r) 6229 } 6230 y = 126 6231 r = x % y 6232 if r != -1 { 6233 t.Errorf("-1 %s 126 = %d, want -1", "%", r) 6234 } 6235 y = 127 6236 r = x % y 6237 if r != -1 { 6238 t.Errorf("-1 %s 127 = %d, want -1", "%", r) 6239 } 6240 x = 0 6241 y = -128 6242 r = x % y 6243 if r != 0 { 6244 t.Errorf("0 %s -128 = %d, want 0", "%", r) 6245 } 6246 y = -127 6247 r = x % y 6248 if r != 0 { 6249 t.Errorf("0 %s -127 = %d, want 0", "%", r) 6250 } 6251 y = -1 6252 r = x % y 6253 if r != 0 { 6254 t.Errorf("0 %s -1 = %d, want 0", "%", r) 6255 } 6256 y = 1 6257 r = x % y 6258 if r != 0 { 6259 t.Errorf("0 %s 1 = %d, want 0", "%", r) 6260 } 6261 y = 126 6262 r = x % y 6263 if r != 0 { 6264 t.Errorf("0 %s 126 = %d, want 0", "%", r) 6265 } 6266 y = 127 6267 r = x % y 6268 if r != 0 { 6269 t.Errorf("0 %s 127 = %d, want 0", "%", r) 6270 } 6271 x = 1 6272 y = -128 6273 r = x % y 6274 if r != 1 { 6275 t.Errorf("1 %s -128 = %d, want 1", "%", r) 6276 } 6277 y = -127 6278 r = x % y 6279 if r != 1 { 6280 t.Errorf("1 %s -127 = %d, want 1", "%", r) 6281 } 6282 y = -1 6283 r = x % y 6284 if r != 0 { 6285 t.Errorf("1 %s -1 = %d, want 0", "%", r) 6286 } 6287 y = 1 6288 r = x % y 6289 if r != 0 { 6290 t.Errorf("1 %s 1 = %d, want 0", "%", r) 6291 } 6292 y = 126 6293 r = x % y 6294 if r != 1 { 6295 t.Errorf("1 %s 126 = %d, want 1", "%", r) 6296 } 6297 y = 127 6298 r = x % y 6299 if r != 1 { 6300 t.Errorf("1 %s 127 = %d, want 1", "%", r) 6301 } 6302 x = 126 6303 y = -128 6304 r = x % y 6305 if r != 126 { 6306 t.Errorf("126 %s -128 = %d, want 126", "%", r) 6307 } 6308 y = -127 6309 r = x % y 6310 if r != 126 { 6311 t.Errorf("126 %s -127 = %d, want 126", "%", r) 6312 } 6313 y = -1 6314 r = x % y 6315 if r != 0 { 6316 t.Errorf("126 %s -1 = %d, want 0", "%", r) 6317 } 6318 y = 1 6319 r = x % y 6320 if r != 0 { 6321 t.Errorf("126 %s 1 = %d, want 0", "%", r) 6322 } 6323 y = 126 6324 r = x % y 6325 if r != 0 { 6326 t.Errorf("126 %s 126 = %d, want 0", "%", r) 6327 } 6328 y = 127 6329 r = x % y 6330 if r != 126 { 6331 t.Errorf("126 %s 127 = %d, want 126", "%", r) 6332 } 6333 x = 127 6334 y = -128 6335 r = x % y 6336 if r != 127 { 6337 t.Errorf("127 %s -128 = %d, want 127", "%", r) 6338 } 6339 y = -127 6340 r = x % y 6341 if r != 0 { 6342 t.Errorf("127 %s -127 = %d, want 0", "%", r) 6343 } 6344 y = -1 6345 r = x % y 6346 if r != 0 { 6347 t.Errorf("127 %s -1 = %d, want 0", "%", r) 6348 } 6349 y = 1 6350 r = x % y 6351 if r != 0 { 6352 t.Errorf("127 %s 1 = %d, want 0", "%", r) 6353 } 6354 y = 126 6355 r = x % y 6356 if r != 1 { 6357 t.Errorf("127 %s 126 = %d, want 1", "%", r) 6358 } 6359 y = 127 6360 r = x % y 6361 if r != 0 { 6362 t.Errorf("127 %s 127 = %d, want 0", "%", r) 6363 } 6364 } 6365 func TestConstFolduint64uint64lsh(t *testing.T) { 6366 var x, r uint64 6367 var y uint64 6368 x = 0 6369 y = 0 6370 r = x << y 6371 if r != 0 { 6372 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 6373 } 6374 y = 1 6375 r = x << y 6376 if r != 0 { 6377 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 6378 } 6379 y = 4294967296 6380 r = x << y 6381 if r != 0 { 6382 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 6383 } 6384 y = 18446744073709551615 6385 r = x << y 6386 if r != 0 { 6387 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 6388 } 6389 x = 1 6390 y = 0 6391 r = x << y 6392 if r != 1 { 6393 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 6394 } 6395 y = 1 6396 r = x << y 6397 if r != 2 { 6398 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 6399 } 6400 y = 4294967296 6401 r = x << y 6402 if r != 0 { 6403 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 6404 } 6405 y = 18446744073709551615 6406 r = x << y 6407 if r != 0 { 6408 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 6409 } 6410 x = 4294967296 6411 y = 0 6412 r = x << y 6413 if r != 4294967296 { 6414 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 6415 } 6416 y = 1 6417 r = x << y 6418 if r != 8589934592 { 6419 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 6420 } 6421 y = 4294967296 6422 r = x << y 6423 if r != 0 { 6424 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "<<", r) 6425 } 6426 y = 18446744073709551615 6427 r = x << y 6428 if r != 0 { 6429 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", "<<", r) 6430 } 6431 x = 18446744073709551615 6432 y = 0 6433 r = x << y 6434 if r != 18446744073709551615 { 6435 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "<<", r) 6436 } 6437 y = 1 6438 r = x << y 6439 if r != 18446744073709551614 { 6440 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "<<", r) 6441 } 6442 y = 4294967296 6443 r = x << y 6444 if r != 0 { 6445 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 0", "<<", r) 6446 } 6447 y = 18446744073709551615 6448 r = x << y 6449 if r != 0 { 6450 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 0", "<<", r) 6451 } 6452 } 6453 func TestConstFolduint64uint64rsh(t *testing.T) { 6454 var x, r uint64 6455 var y uint64 6456 x = 0 6457 y = 0 6458 r = x >> y 6459 if r != 0 { 6460 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 6461 } 6462 y = 1 6463 r = x >> y 6464 if r != 0 { 6465 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 6466 } 6467 y = 4294967296 6468 r = x >> y 6469 if r != 0 { 6470 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 6471 } 6472 y = 18446744073709551615 6473 r = x >> y 6474 if r != 0 { 6475 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 6476 } 6477 x = 1 6478 y = 0 6479 r = x >> y 6480 if r != 1 { 6481 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 6482 } 6483 y = 1 6484 r = x >> y 6485 if r != 0 { 6486 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 6487 } 6488 y = 4294967296 6489 r = x >> y 6490 if r != 0 { 6491 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 6492 } 6493 y = 18446744073709551615 6494 r = x >> y 6495 if r != 0 { 6496 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 6497 } 6498 x = 4294967296 6499 y = 0 6500 r = x >> y 6501 if r != 4294967296 { 6502 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 6503 } 6504 y = 1 6505 r = x >> y 6506 if r != 2147483648 { 6507 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 6508 } 6509 y = 4294967296 6510 r = x >> y 6511 if r != 0 { 6512 t.Errorf("4294967296 %s 4294967296 = %d, want 0", ">>", r) 6513 } 6514 y = 18446744073709551615 6515 r = x >> y 6516 if r != 0 { 6517 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", ">>", r) 6518 } 6519 x = 18446744073709551615 6520 y = 0 6521 r = x >> y 6522 if r != 18446744073709551615 { 6523 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", ">>", r) 6524 } 6525 y = 1 6526 r = x >> y 6527 if r != 9223372036854775807 { 6528 t.Errorf("18446744073709551615 %s 1 = %d, want 9223372036854775807", ">>", r) 6529 } 6530 y = 4294967296 6531 r = x >> y 6532 if r != 0 { 6533 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 0", ">>", r) 6534 } 6535 y = 18446744073709551615 6536 r = x >> y 6537 if r != 0 { 6538 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 0", ">>", r) 6539 } 6540 } 6541 func TestConstFolduint64uint32lsh(t *testing.T) { 6542 var x, r uint64 6543 var y uint32 6544 x = 0 6545 y = 0 6546 r = x << y 6547 if r != 0 { 6548 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 6549 } 6550 y = 1 6551 r = x << y 6552 if r != 0 { 6553 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 6554 } 6555 y = 4294967295 6556 r = x << y 6557 if r != 0 { 6558 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 6559 } 6560 x = 1 6561 y = 0 6562 r = x << y 6563 if r != 1 { 6564 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 6565 } 6566 y = 1 6567 r = x << y 6568 if r != 2 { 6569 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 6570 } 6571 y = 4294967295 6572 r = x << y 6573 if r != 0 { 6574 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 6575 } 6576 x = 4294967296 6577 y = 0 6578 r = x << y 6579 if r != 4294967296 { 6580 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 6581 } 6582 y = 1 6583 r = x << y 6584 if r != 8589934592 { 6585 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 6586 } 6587 y = 4294967295 6588 r = x << y 6589 if r != 0 { 6590 t.Errorf("4294967296 %s 4294967295 = %d, want 0", "<<", r) 6591 } 6592 x = 18446744073709551615 6593 y = 0 6594 r = x << y 6595 if r != 18446744073709551615 { 6596 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "<<", r) 6597 } 6598 y = 1 6599 r = x << y 6600 if r != 18446744073709551614 { 6601 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "<<", r) 6602 } 6603 y = 4294967295 6604 r = x << y 6605 if r != 0 { 6606 t.Errorf("18446744073709551615 %s 4294967295 = %d, want 0", "<<", r) 6607 } 6608 } 6609 func TestConstFolduint64uint32rsh(t *testing.T) { 6610 var x, r uint64 6611 var y uint32 6612 x = 0 6613 y = 0 6614 r = x >> y 6615 if r != 0 { 6616 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 6617 } 6618 y = 1 6619 r = x >> y 6620 if r != 0 { 6621 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 6622 } 6623 y = 4294967295 6624 r = x >> y 6625 if r != 0 { 6626 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 6627 } 6628 x = 1 6629 y = 0 6630 r = x >> y 6631 if r != 1 { 6632 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 6633 } 6634 y = 1 6635 r = x >> y 6636 if r != 0 { 6637 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 6638 } 6639 y = 4294967295 6640 r = x >> y 6641 if r != 0 { 6642 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 6643 } 6644 x = 4294967296 6645 y = 0 6646 r = x >> y 6647 if r != 4294967296 { 6648 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 6649 } 6650 y = 1 6651 r = x >> y 6652 if r != 2147483648 { 6653 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 6654 } 6655 y = 4294967295 6656 r = x >> y 6657 if r != 0 { 6658 t.Errorf("4294967296 %s 4294967295 = %d, want 0", ">>", r) 6659 } 6660 x = 18446744073709551615 6661 y = 0 6662 r = x >> y 6663 if r != 18446744073709551615 { 6664 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", ">>", r) 6665 } 6666 y = 1 6667 r = x >> y 6668 if r != 9223372036854775807 { 6669 t.Errorf("18446744073709551615 %s 1 = %d, want 9223372036854775807", ">>", r) 6670 } 6671 y = 4294967295 6672 r = x >> y 6673 if r != 0 { 6674 t.Errorf("18446744073709551615 %s 4294967295 = %d, want 0", ">>", r) 6675 } 6676 } 6677 func TestConstFolduint64uint16lsh(t *testing.T) { 6678 var x, r uint64 6679 var y uint16 6680 x = 0 6681 y = 0 6682 r = x << y 6683 if r != 0 { 6684 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 6685 } 6686 y = 1 6687 r = x << y 6688 if r != 0 { 6689 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 6690 } 6691 y = 65535 6692 r = x << y 6693 if r != 0 { 6694 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 6695 } 6696 x = 1 6697 y = 0 6698 r = x << y 6699 if r != 1 { 6700 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 6701 } 6702 y = 1 6703 r = x << y 6704 if r != 2 { 6705 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 6706 } 6707 y = 65535 6708 r = x << y 6709 if r != 0 { 6710 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 6711 } 6712 x = 4294967296 6713 y = 0 6714 r = x << y 6715 if r != 4294967296 { 6716 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 6717 } 6718 y = 1 6719 r = x << y 6720 if r != 8589934592 { 6721 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 6722 } 6723 y = 65535 6724 r = x << y 6725 if r != 0 { 6726 t.Errorf("4294967296 %s 65535 = %d, want 0", "<<", r) 6727 } 6728 x = 18446744073709551615 6729 y = 0 6730 r = x << y 6731 if r != 18446744073709551615 { 6732 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "<<", r) 6733 } 6734 y = 1 6735 r = x << y 6736 if r != 18446744073709551614 { 6737 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "<<", r) 6738 } 6739 y = 65535 6740 r = x << y 6741 if r != 0 { 6742 t.Errorf("18446744073709551615 %s 65535 = %d, want 0", "<<", r) 6743 } 6744 } 6745 func TestConstFolduint64uint16rsh(t *testing.T) { 6746 var x, r uint64 6747 var y uint16 6748 x = 0 6749 y = 0 6750 r = x >> y 6751 if r != 0 { 6752 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 6753 } 6754 y = 1 6755 r = x >> y 6756 if r != 0 { 6757 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 6758 } 6759 y = 65535 6760 r = x >> y 6761 if r != 0 { 6762 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 6763 } 6764 x = 1 6765 y = 0 6766 r = x >> y 6767 if r != 1 { 6768 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 6769 } 6770 y = 1 6771 r = x >> y 6772 if r != 0 { 6773 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 6774 } 6775 y = 65535 6776 r = x >> y 6777 if r != 0 { 6778 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 6779 } 6780 x = 4294967296 6781 y = 0 6782 r = x >> y 6783 if r != 4294967296 { 6784 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 6785 } 6786 y = 1 6787 r = x >> y 6788 if r != 2147483648 { 6789 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 6790 } 6791 y = 65535 6792 r = x >> y 6793 if r != 0 { 6794 t.Errorf("4294967296 %s 65535 = %d, want 0", ">>", r) 6795 } 6796 x = 18446744073709551615 6797 y = 0 6798 r = x >> y 6799 if r != 18446744073709551615 { 6800 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", ">>", r) 6801 } 6802 y = 1 6803 r = x >> y 6804 if r != 9223372036854775807 { 6805 t.Errorf("18446744073709551615 %s 1 = %d, want 9223372036854775807", ">>", r) 6806 } 6807 y = 65535 6808 r = x >> y 6809 if r != 0 { 6810 t.Errorf("18446744073709551615 %s 65535 = %d, want 0", ">>", r) 6811 } 6812 } 6813 func TestConstFolduint64uint8lsh(t *testing.T) { 6814 var x, r uint64 6815 var y uint8 6816 x = 0 6817 y = 0 6818 r = x << y 6819 if r != 0 { 6820 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 6821 } 6822 y = 1 6823 r = x << y 6824 if r != 0 { 6825 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 6826 } 6827 y = 255 6828 r = x << y 6829 if r != 0 { 6830 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 6831 } 6832 x = 1 6833 y = 0 6834 r = x << y 6835 if r != 1 { 6836 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 6837 } 6838 y = 1 6839 r = x << y 6840 if r != 2 { 6841 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 6842 } 6843 y = 255 6844 r = x << y 6845 if r != 0 { 6846 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 6847 } 6848 x = 4294967296 6849 y = 0 6850 r = x << y 6851 if r != 4294967296 { 6852 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 6853 } 6854 y = 1 6855 r = x << y 6856 if r != 8589934592 { 6857 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 6858 } 6859 y = 255 6860 r = x << y 6861 if r != 0 { 6862 t.Errorf("4294967296 %s 255 = %d, want 0", "<<", r) 6863 } 6864 x = 18446744073709551615 6865 y = 0 6866 r = x << y 6867 if r != 18446744073709551615 { 6868 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "<<", r) 6869 } 6870 y = 1 6871 r = x << y 6872 if r != 18446744073709551614 { 6873 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "<<", r) 6874 } 6875 y = 255 6876 r = x << y 6877 if r != 0 { 6878 t.Errorf("18446744073709551615 %s 255 = %d, want 0", "<<", r) 6879 } 6880 } 6881 func TestConstFolduint64uint8rsh(t *testing.T) { 6882 var x, r uint64 6883 var y uint8 6884 x = 0 6885 y = 0 6886 r = x >> y 6887 if r != 0 { 6888 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 6889 } 6890 y = 1 6891 r = x >> y 6892 if r != 0 { 6893 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 6894 } 6895 y = 255 6896 r = x >> y 6897 if r != 0 { 6898 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 6899 } 6900 x = 1 6901 y = 0 6902 r = x >> y 6903 if r != 1 { 6904 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 6905 } 6906 y = 1 6907 r = x >> y 6908 if r != 0 { 6909 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 6910 } 6911 y = 255 6912 r = x >> y 6913 if r != 0 { 6914 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 6915 } 6916 x = 4294967296 6917 y = 0 6918 r = x >> y 6919 if r != 4294967296 { 6920 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 6921 } 6922 y = 1 6923 r = x >> y 6924 if r != 2147483648 { 6925 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 6926 } 6927 y = 255 6928 r = x >> y 6929 if r != 0 { 6930 t.Errorf("4294967296 %s 255 = %d, want 0", ">>", r) 6931 } 6932 x = 18446744073709551615 6933 y = 0 6934 r = x >> y 6935 if r != 18446744073709551615 { 6936 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", ">>", r) 6937 } 6938 y = 1 6939 r = x >> y 6940 if r != 9223372036854775807 { 6941 t.Errorf("18446744073709551615 %s 1 = %d, want 9223372036854775807", ">>", r) 6942 } 6943 y = 255 6944 r = x >> y 6945 if r != 0 { 6946 t.Errorf("18446744073709551615 %s 255 = %d, want 0", ">>", r) 6947 } 6948 } 6949 func TestConstFoldint64uint64lsh(t *testing.T) { 6950 var x, r int64 6951 var y uint64 6952 x = -9223372036854775808 6953 y = 0 6954 r = x << y 6955 if r != -9223372036854775808 { 6956 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "<<", r) 6957 } 6958 y = 1 6959 r = x << y 6960 if r != 0 { 6961 t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "<<", r) 6962 } 6963 y = 4294967296 6964 r = x << y 6965 if r != 0 { 6966 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 0", "<<", r) 6967 } 6968 y = 18446744073709551615 6969 r = x << y 6970 if r != 0 { 6971 t.Errorf("-9223372036854775808 %s 18446744073709551615 = %d, want 0", "<<", r) 6972 } 6973 x = -9223372036854775807 6974 y = 0 6975 r = x << y 6976 if r != -9223372036854775807 { 6977 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "<<", r) 6978 } 6979 y = 1 6980 r = x << y 6981 if r != 2 { 6982 t.Errorf("-9223372036854775807 %s 1 = %d, want 2", "<<", r) 6983 } 6984 y = 4294967296 6985 r = x << y 6986 if r != 0 { 6987 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want 0", "<<", r) 6988 } 6989 y = 18446744073709551615 6990 r = x << y 6991 if r != 0 { 6992 t.Errorf("-9223372036854775807 %s 18446744073709551615 = %d, want 0", "<<", r) 6993 } 6994 x = -4294967296 6995 y = 0 6996 r = x << y 6997 if r != -4294967296 { 6998 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "<<", r) 6999 } 7000 y = 1 7001 r = x << y 7002 if r != -8589934592 { 7003 t.Errorf("-4294967296 %s 1 = %d, want -8589934592", "<<", r) 7004 } 7005 y = 4294967296 7006 r = x << y 7007 if r != 0 { 7008 t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "<<", r) 7009 } 7010 y = 18446744073709551615 7011 r = x << y 7012 if r != 0 { 7013 t.Errorf("-4294967296 %s 18446744073709551615 = %d, want 0", "<<", r) 7014 } 7015 x = -1 7016 y = 0 7017 r = x << y 7018 if r != -1 { 7019 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 7020 } 7021 y = 1 7022 r = x << y 7023 if r != -2 { 7024 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 7025 } 7026 y = 4294967296 7027 r = x << y 7028 if r != 0 { 7029 t.Errorf("-1 %s 4294967296 = %d, want 0", "<<", r) 7030 } 7031 y = 18446744073709551615 7032 r = x << y 7033 if r != 0 { 7034 t.Errorf("-1 %s 18446744073709551615 = %d, want 0", "<<", r) 7035 } 7036 x = 0 7037 y = 0 7038 r = x << y 7039 if r != 0 { 7040 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 7041 } 7042 y = 1 7043 r = x << y 7044 if r != 0 { 7045 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 7046 } 7047 y = 4294967296 7048 r = x << y 7049 if r != 0 { 7050 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 7051 } 7052 y = 18446744073709551615 7053 r = x << y 7054 if r != 0 { 7055 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 7056 } 7057 x = 1 7058 y = 0 7059 r = x << y 7060 if r != 1 { 7061 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 7062 } 7063 y = 1 7064 r = x << y 7065 if r != 2 { 7066 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 7067 } 7068 y = 4294967296 7069 r = x << y 7070 if r != 0 { 7071 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 7072 } 7073 y = 18446744073709551615 7074 r = x << y 7075 if r != 0 { 7076 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 7077 } 7078 x = 4294967296 7079 y = 0 7080 r = x << y 7081 if r != 4294967296 { 7082 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 7083 } 7084 y = 1 7085 r = x << y 7086 if r != 8589934592 { 7087 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 7088 } 7089 y = 4294967296 7090 r = x << y 7091 if r != 0 { 7092 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "<<", r) 7093 } 7094 y = 18446744073709551615 7095 r = x << y 7096 if r != 0 { 7097 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", "<<", r) 7098 } 7099 x = 9223372036854775806 7100 y = 0 7101 r = x << y 7102 if r != 9223372036854775806 { 7103 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "<<", r) 7104 } 7105 y = 1 7106 r = x << y 7107 if r != -4 { 7108 t.Errorf("9223372036854775806 %s 1 = %d, want -4", "<<", r) 7109 } 7110 y = 4294967296 7111 r = x << y 7112 if r != 0 { 7113 t.Errorf("9223372036854775806 %s 4294967296 = %d, want 0", "<<", r) 7114 } 7115 y = 18446744073709551615 7116 r = x << y 7117 if r != 0 { 7118 t.Errorf("9223372036854775806 %s 18446744073709551615 = %d, want 0", "<<", r) 7119 } 7120 x = 9223372036854775807 7121 y = 0 7122 r = x << y 7123 if r != 9223372036854775807 { 7124 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "<<", r) 7125 } 7126 y = 1 7127 r = x << y 7128 if r != -2 { 7129 t.Errorf("9223372036854775807 %s 1 = %d, want -2", "<<", r) 7130 } 7131 y = 4294967296 7132 r = x << y 7133 if r != 0 { 7134 t.Errorf("9223372036854775807 %s 4294967296 = %d, want 0", "<<", r) 7135 } 7136 y = 18446744073709551615 7137 r = x << y 7138 if r != 0 { 7139 t.Errorf("9223372036854775807 %s 18446744073709551615 = %d, want 0", "<<", r) 7140 } 7141 } 7142 func TestConstFoldint64uint64rsh(t *testing.T) { 7143 var x, r int64 7144 var y uint64 7145 x = -9223372036854775808 7146 y = 0 7147 r = x >> y 7148 if r != -9223372036854775808 { 7149 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", ">>", r) 7150 } 7151 y = 1 7152 r = x >> y 7153 if r != -4611686018427387904 { 7154 t.Errorf("-9223372036854775808 %s 1 = %d, want -4611686018427387904", ">>", r) 7155 } 7156 y = 4294967296 7157 r = x >> y 7158 if r != -1 { 7159 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want -1", ">>", r) 7160 } 7161 y = 18446744073709551615 7162 r = x >> y 7163 if r != -1 { 7164 t.Errorf("-9223372036854775808 %s 18446744073709551615 = %d, want -1", ">>", r) 7165 } 7166 x = -9223372036854775807 7167 y = 0 7168 r = x >> y 7169 if r != -9223372036854775807 { 7170 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", ">>", r) 7171 } 7172 y = 1 7173 r = x >> y 7174 if r != -4611686018427387904 { 7175 t.Errorf("-9223372036854775807 %s 1 = %d, want -4611686018427387904", ">>", r) 7176 } 7177 y = 4294967296 7178 r = x >> y 7179 if r != -1 { 7180 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -1", ">>", r) 7181 } 7182 y = 18446744073709551615 7183 r = x >> y 7184 if r != -1 { 7185 t.Errorf("-9223372036854775807 %s 18446744073709551615 = %d, want -1", ">>", r) 7186 } 7187 x = -4294967296 7188 y = 0 7189 r = x >> y 7190 if r != -4294967296 { 7191 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", ">>", r) 7192 } 7193 y = 1 7194 r = x >> y 7195 if r != -2147483648 { 7196 t.Errorf("-4294967296 %s 1 = %d, want -2147483648", ">>", r) 7197 } 7198 y = 4294967296 7199 r = x >> y 7200 if r != -1 { 7201 t.Errorf("-4294967296 %s 4294967296 = %d, want -1", ">>", r) 7202 } 7203 y = 18446744073709551615 7204 r = x >> y 7205 if r != -1 { 7206 t.Errorf("-4294967296 %s 18446744073709551615 = %d, want -1", ">>", r) 7207 } 7208 x = -1 7209 y = 0 7210 r = x >> y 7211 if r != -1 { 7212 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 7213 } 7214 y = 1 7215 r = x >> y 7216 if r != -1 { 7217 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 7218 } 7219 y = 4294967296 7220 r = x >> y 7221 if r != -1 { 7222 t.Errorf("-1 %s 4294967296 = %d, want -1", ">>", r) 7223 } 7224 y = 18446744073709551615 7225 r = x >> y 7226 if r != -1 { 7227 t.Errorf("-1 %s 18446744073709551615 = %d, want -1", ">>", r) 7228 } 7229 x = 0 7230 y = 0 7231 r = x >> y 7232 if r != 0 { 7233 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 7234 } 7235 y = 1 7236 r = x >> y 7237 if r != 0 { 7238 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 7239 } 7240 y = 4294967296 7241 r = x >> y 7242 if r != 0 { 7243 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 7244 } 7245 y = 18446744073709551615 7246 r = x >> y 7247 if r != 0 { 7248 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 7249 } 7250 x = 1 7251 y = 0 7252 r = x >> y 7253 if r != 1 { 7254 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 7255 } 7256 y = 1 7257 r = x >> y 7258 if r != 0 { 7259 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 7260 } 7261 y = 4294967296 7262 r = x >> y 7263 if r != 0 { 7264 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 7265 } 7266 y = 18446744073709551615 7267 r = x >> y 7268 if r != 0 { 7269 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 7270 } 7271 x = 4294967296 7272 y = 0 7273 r = x >> y 7274 if r != 4294967296 { 7275 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 7276 } 7277 y = 1 7278 r = x >> y 7279 if r != 2147483648 { 7280 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 7281 } 7282 y = 4294967296 7283 r = x >> y 7284 if r != 0 { 7285 t.Errorf("4294967296 %s 4294967296 = %d, want 0", ">>", r) 7286 } 7287 y = 18446744073709551615 7288 r = x >> y 7289 if r != 0 { 7290 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", ">>", r) 7291 } 7292 x = 9223372036854775806 7293 y = 0 7294 r = x >> y 7295 if r != 9223372036854775806 { 7296 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", ">>", r) 7297 } 7298 y = 1 7299 r = x >> y 7300 if r != 4611686018427387903 { 7301 t.Errorf("9223372036854775806 %s 1 = %d, want 4611686018427387903", ">>", r) 7302 } 7303 y = 4294967296 7304 r = x >> y 7305 if r != 0 { 7306 t.Errorf("9223372036854775806 %s 4294967296 = %d, want 0", ">>", r) 7307 } 7308 y = 18446744073709551615 7309 r = x >> y 7310 if r != 0 { 7311 t.Errorf("9223372036854775806 %s 18446744073709551615 = %d, want 0", ">>", r) 7312 } 7313 x = 9223372036854775807 7314 y = 0 7315 r = x >> y 7316 if r != 9223372036854775807 { 7317 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", ">>", r) 7318 } 7319 y = 1 7320 r = x >> y 7321 if r != 4611686018427387903 { 7322 t.Errorf("9223372036854775807 %s 1 = %d, want 4611686018427387903", ">>", r) 7323 } 7324 y = 4294967296 7325 r = x >> y 7326 if r != 0 { 7327 t.Errorf("9223372036854775807 %s 4294967296 = %d, want 0", ">>", r) 7328 } 7329 y = 18446744073709551615 7330 r = x >> y 7331 if r != 0 { 7332 t.Errorf("9223372036854775807 %s 18446744073709551615 = %d, want 0", ">>", r) 7333 } 7334 } 7335 func TestConstFoldint64uint32lsh(t *testing.T) { 7336 var x, r int64 7337 var y uint32 7338 x = -9223372036854775808 7339 y = 0 7340 r = x << y 7341 if r != -9223372036854775808 { 7342 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "<<", r) 7343 } 7344 y = 1 7345 r = x << y 7346 if r != 0 { 7347 t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "<<", r) 7348 } 7349 y = 4294967295 7350 r = x << y 7351 if r != 0 { 7352 t.Errorf("-9223372036854775808 %s 4294967295 = %d, want 0", "<<", r) 7353 } 7354 x = -9223372036854775807 7355 y = 0 7356 r = x << y 7357 if r != -9223372036854775807 { 7358 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "<<", r) 7359 } 7360 y = 1 7361 r = x << y 7362 if r != 2 { 7363 t.Errorf("-9223372036854775807 %s 1 = %d, want 2", "<<", r) 7364 } 7365 y = 4294967295 7366 r = x << y 7367 if r != 0 { 7368 t.Errorf("-9223372036854775807 %s 4294967295 = %d, want 0", "<<", r) 7369 } 7370 x = -4294967296 7371 y = 0 7372 r = x << y 7373 if r != -4294967296 { 7374 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "<<", r) 7375 } 7376 y = 1 7377 r = x << y 7378 if r != -8589934592 { 7379 t.Errorf("-4294967296 %s 1 = %d, want -8589934592", "<<", r) 7380 } 7381 y = 4294967295 7382 r = x << y 7383 if r != 0 { 7384 t.Errorf("-4294967296 %s 4294967295 = %d, want 0", "<<", r) 7385 } 7386 x = -1 7387 y = 0 7388 r = x << y 7389 if r != -1 { 7390 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 7391 } 7392 y = 1 7393 r = x << y 7394 if r != -2 { 7395 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 7396 } 7397 y = 4294967295 7398 r = x << y 7399 if r != 0 { 7400 t.Errorf("-1 %s 4294967295 = %d, want 0", "<<", r) 7401 } 7402 x = 0 7403 y = 0 7404 r = x << y 7405 if r != 0 { 7406 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 7407 } 7408 y = 1 7409 r = x << y 7410 if r != 0 { 7411 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 7412 } 7413 y = 4294967295 7414 r = x << y 7415 if r != 0 { 7416 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 7417 } 7418 x = 1 7419 y = 0 7420 r = x << y 7421 if r != 1 { 7422 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 7423 } 7424 y = 1 7425 r = x << y 7426 if r != 2 { 7427 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 7428 } 7429 y = 4294967295 7430 r = x << y 7431 if r != 0 { 7432 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 7433 } 7434 x = 4294967296 7435 y = 0 7436 r = x << y 7437 if r != 4294967296 { 7438 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 7439 } 7440 y = 1 7441 r = x << y 7442 if r != 8589934592 { 7443 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 7444 } 7445 y = 4294967295 7446 r = x << y 7447 if r != 0 { 7448 t.Errorf("4294967296 %s 4294967295 = %d, want 0", "<<", r) 7449 } 7450 x = 9223372036854775806 7451 y = 0 7452 r = x << y 7453 if r != 9223372036854775806 { 7454 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "<<", r) 7455 } 7456 y = 1 7457 r = x << y 7458 if r != -4 { 7459 t.Errorf("9223372036854775806 %s 1 = %d, want -4", "<<", r) 7460 } 7461 y = 4294967295 7462 r = x << y 7463 if r != 0 { 7464 t.Errorf("9223372036854775806 %s 4294967295 = %d, want 0", "<<", r) 7465 } 7466 x = 9223372036854775807 7467 y = 0 7468 r = x << y 7469 if r != 9223372036854775807 { 7470 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "<<", r) 7471 } 7472 y = 1 7473 r = x << y 7474 if r != -2 { 7475 t.Errorf("9223372036854775807 %s 1 = %d, want -2", "<<", r) 7476 } 7477 y = 4294967295 7478 r = x << y 7479 if r != 0 { 7480 t.Errorf("9223372036854775807 %s 4294967295 = %d, want 0", "<<", r) 7481 } 7482 } 7483 func TestConstFoldint64uint32rsh(t *testing.T) { 7484 var x, r int64 7485 var y uint32 7486 x = -9223372036854775808 7487 y = 0 7488 r = x >> y 7489 if r != -9223372036854775808 { 7490 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", ">>", r) 7491 } 7492 y = 1 7493 r = x >> y 7494 if r != -4611686018427387904 { 7495 t.Errorf("-9223372036854775808 %s 1 = %d, want -4611686018427387904", ">>", r) 7496 } 7497 y = 4294967295 7498 r = x >> y 7499 if r != -1 { 7500 t.Errorf("-9223372036854775808 %s 4294967295 = %d, want -1", ">>", r) 7501 } 7502 x = -9223372036854775807 7503 y = 0 7504 r = x >> y 7505 if r != -9223372036854775807 { 7506 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", ">>", r) 7507 } 7508 y = 1 7509 r = x >> y 7510 if r != -4611686018427387904 { 7511 t.Errorf("-9223372036854775807 %s 1 = %d, want -4611686018427387904", ">>", r) 7512 } 7513 y = 4294967295 7514 r = x >> y 7515 if r != -1 { 7516 t.Errorf("-9223372036854775807 %s 4294967295 = %d, want -1", ">>", r) 7517 } 7518 x = -4294967296 7519 y = 0 7520 r = x >> y 7521 if r != -4294967296 { 7522 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", ">>", r) 7523 } 7524 y = 1 7525 r = x >> y 7526 if r != -2147483648 { 7527 t.Errorf("-4294967296 %s 1 = %d, want -2147483648", ">>", r) 7528 } 7529 y = 4294967295 7530 r = x >> y 7531 if r != -1 { 7532 t.Errorf("-4294967296 %s 4294967295 = %d, want -1", ">>", r) 7533 } 7534 x = -1 7535 y = 0 7536 r = x >> y 7537 if r != -1 { 7538 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 7539 } 7540 y = 1 7541 r = x >> y 7542 if r != -1 { 7543 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 7544 } 7545 y = 4294967295 7546 r = x >> y 7547 if r != -1 { 7548 t.Errorf("-1 %s 4294967295 = %d, want -1", ">>", r) 7549 } 7550 x = 0 7551 y = 0 7552 r = x >> y 7553 if r != 0 { 7554 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 7555 } 7556 y = 1 7557 r = x >> y 7558 if r != 0 { 7559 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 7560 } 7561 y = 4294967295 7562 r = x >> y 7563 if r != 0 { 7564 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 7565 } 7566 x = 1 7567 y = 0 7568 r = x >> y 7569 if r != 1 { 7570 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 7571 } 7572 y = 1 7573 r = x >> y 7574 if r != 0 { 7575 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 7576 } 7577 y = 4294967295 7578 r = x >> y 7579 if r != 0 { 7580 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 7581 } 7582 x = 4294967296 7583 y = 0 7584 r = x >> y 7585 if r != 4294967296 { 7586 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 7587 } 7588 y = 1 7589 r = x >> y 7590 if r != 2147483648 { 7591 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 7592 } 7593 y = 4294967295 7594 r = x >> y 7595 if r != 0 { 7596 t.Errorf("4294967296 %s 4294967295 = %d, want 0", ">>", r) 7597 } 7598 x = 9223372036854775806 7599 y = 0 7600 r = x >> y 7601 if r != 9223372036854775806 { 7602 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", ">>", r) 7603 } 7604 y = 1 7605 r = x >> y 7606 if r != 4611686018427387903 { 7607 t.Errorf("9223372036854775806 %s 1 = %d, want 4611686018427387903", ">>", r) 7608 } 7609 y = 4294967295 7610 r = x >> y 7611 if r != 0 { 7612 t.Errorf("9223372036854775806 %s 4294967295 = %d, want 0", ">>", r) 7613 } 7614 x = 9223372036854775807 7615 y = 0 7616 r = x >> y 7617 if r != 9223372036854775807 { 7618 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", ">>", r) 7619 } 7620 y = 1 7621 r = x >> y 7622 if r != 4611686018427387903 { 7623 t.Errorf("9223372036854775807 %s 1 = %d, want 4611686018427387903", ">>", r) 7624 } 7625 y = 4294967295 7626 r = x >> y 7627 if r != 0 { 7628 t.Errorf("9223372036854775807 %s 4294967295 = %d, want 0", ">>", r) 7629 } 7630 } 7631 func TestConstFoldint64uint16lsh(t *testing.T) { 7632 var x, r int64 7633 var y uint16 7634 x = -9223372036854775808 7635 y = 0 7636 r = x << y 7637 if r != -9223372036854775808 { 7638 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "<<", r) 7639 } 7640 y = 1 7641 r = x << y 7642 if r != 0 { 7643 t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "<<", r) 7644 } 7645 y = 65535 7646 r = x << y 7647 if r != 0 { 7648 t.Errorf("-9223372036854775808 %s 65535 = %d, want 0", "<<", r) 7649 } 7650 x = -9223372036854775807 7651 y = 0 7652 r = x << y 7653 if r != -9223372036854775807 { 7654 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "<<", r) 7655 } 7656 y = 1 7657 r = x << y 7658 if r != 2 { 7659 t.Errorf("-9223372036854775807 %s 1 = %d, want 2", "<<", r) 7660 } 7661 y = 65535 7662 r = x << y 7663 if r != 0 { 7664 t.Errorf("-9223372036854775807 %s 65535 = %d, want 0", "<<", r) 7665 } 7666 x = -4294967296 7667 y = 0 7668 r = x << y 7669 if r != -4294967296 { 7670 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "<<", r) 7671 } 7672 y = 1 7673 r = x << y 7674 if r != -8589934592 { 7675 t.Errorf("-4294967296 %s 1 = %d, want -8589934592", "<<", r) 7676 } 7677 y = 65535 7678 r = x << y 7679 if r != 0 { 7680 t.Errorf("-4294967296 %s 65535 = %d, want 0", "<<", r) 7681 } 7682 x = -1 7683 y = 0 7684 r = x << y 7685 if r != -1 { 7686 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 7687 } 7688 y = 1 7689 r = x << y 7690 if r != -2 { 7691 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 7692 } 7693 y = 65535 7694 r = x << y 7695 if r != 0 { 7696 t.Errorf("-1 %s 65535 = %d, want 0", "<<", r) 7697 } 7698 x = 0 7699 y = 0 7700 r = x << y 7701 if r != 0 { 7702 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 7703 } 7704 y = 1 7705 r = x << y 7706 if r != 0 { 7707 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 7708 } 7709 y = 65535 7710 r = x << y 7711 if r != 0 { 7712 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 7713 } 7714 x = 1 7715 y = 0 7716 r = x << y 7717 if r != 1 { 7718 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 7719 } 7720 y = 1 7721 r = x << y 7722 if r != 2 { 7723 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 7724 } 7725 y = 65535 7726 r = x << y 7727 if r != 0 { 7728 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 7729 } 7730 x = 4294967296 7731 y = 0 7732 r = x << y 7733 if r != 4294967296 { 7734 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 7735 } 7736 y = 1 7737 r = x << y 7738 if r != 8589934592 { 7739 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 7740 } 7741 y = 65535 7742 r = x << y 7743 if r != 0 { 7744 t.Errorf("4294967296 %s 65535 = %d, want 0", "<<", r) 7745 } 7746 x = 9223372036854775806 7747 y = 0 7748 r = x << y 7749 if r != 9223372036854775806 { 7750 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "<<", r) 7751 } 7752 y = 1 7753 r = x << y 7754 if r != -4 { 7755 t.Errorf("9223372036854775806 %s 1 = %d, want -4", "<<", r) 7756 } 7757 y = 65535 7758 r = x << y 7759 if r != 0 { 7760 t.Errorf("9223372036854775806 %s 65535 = %d, want 0", "<<", r) 7761 } 7762 x = 9223372036854775807 7763 y = 0 7764 r = x << y 7765 if r != 9223372036854775807 { 7766 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "<<", r) 7767 } 7768 y = 1 7769 r = x << y 7770 if r != -2 { 7771 t.Errorf("9223372036854775807 %s 1 = %d, want -2", "<<", r) 7772 } 7773 y = 65535 7774 r = x << y 7775 if r != 0 { 7776 t.Errorf("9223372036854775807 %s 65535 = %d, want 0", "<<", r) 7777 } 7778 } 7779 func TestConstFoldint64uint16rsh(t *testing.T) { 7780 var x, r int64 7781 var y uint16 7782 x = -9223372036854775808 7783 y = 0 7784 r = x >> y 7785 if r != -9223372036854775808 { 7786 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", ">>", r) 7787 } 7788 y = 1 7789 r = x >> y 7790 if r != -4611686018427387904 { 7791 t.Errorf("-9223372036854775808 %s 1 = %d, want -4611686018427387904", ">>", r) 7792 } 7793 y = 65535 7794 r = x >> y 7795 if r != -1 { 7796 t.Errorf("-9223372036854775808 %s 65535 = %d, want -1", ">>", r) 7797 } 7798 x = -9223372036854775807 7799 y = 0 7800 r = x >> y 7801 if r != -9223372036854775807 { 7802 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", ">>", r) 7803 } 7804 y = 1 7805 r = x >> y 7806 if r != -4611686018427387904 { 7807 t.Errorf("-9223372036854775807 %s 1 = %d, want -4611686018427387904", ">>", r) 7808 } 7809 y = 65535 7810 r = x >> y 7811 if r != -1 { 7812 t.Errorf("-9223372036854775807 %s 65535 = %d, want -1", ">>", r) 7813 } 7814 x = -4294967296 7815 y = 0 7816 r = x >> y 7817 if r != -4294967296 { 7818 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", ">>", r) 7819 } 7820 y = 1 7821 r = x >> y 7822 if r != -2147483648 { 7823 t.Errorf("-4294967296 %s 1 = %d, want -2147483648", ">>", r) 7824 } 7825 y = 65535 7826 r = x >> y 7827 if r != -1 { 7828 t.Errorf("-4294967296 %s 65535 = %d, want -1", ">>", r) 7829 } 7830 x = -1 7831 y = 0 7832 r = x >> y 7833 if r != -1 { 7834 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 7835 } 7836 y = 1 7837 r = x >> y 7838 if r != -1 { 7839 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 7840 } 7841 y = 65535 7842 r = x >> y 7843 if r != -1 { 7844 t.Errorf("-1 %s 65535 = %d, want -1", ">>", r) 7845 } 7846 x = 0 7847 y = 0 7848 r = x >> y 7849 if r != 0 { 7850 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 7851 } 7852 y = 1 7853 r = x >> y 7854 if r != 0 { 7855 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 7856 } 7857 y = 65535 7858 r = x >> y 7859 if r != 0 { 7860 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 7861 } 7862 x = 1 7863 y = 0 7864 r = x >> y 7865 if r != 1 { 7866 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 7867 } 7868 y = 1 7869 r = x >> y 7870 if r != 0 { 7871 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 7872 } 7873 y = 65535 7874 r = x >> y 7875 if r != 0 { 7876 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 7877 } 7878 x = 4294967296 7879 y = 0 7880 r = x >> y 7881 if r != 4294967296 { 7882 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 7883 } 7884 y = 1 7885 r = x >> y 7886 if r != 2147483648 { 7887 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 7888 } 7889 y = 65535 7890 r = x >> y 7891 if r != 0 { 7892 t.Errorf("4294967296 %s 65535 = %d, want 0", ">>", r) 7893 } 7894 x = 9223372036854775806 7895 y = 0 7896 r = x >> y 7897 if r != 9223372036854775806 { 7898 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", ">>", r) 7899 } 7900 y = 1 7901 r = x >> y 7902 if r != 4611686018427387903 { 7903 t.Errorf("9223372036854775806 %s 1 = %d, want 4611686018427387903", ">>", r) 7904 } 7905 y = 65535 7906 r = x >> y 7907 if r != 0 { 7908 t.Errorf("9223372036854775806 %s 65535 = %d, want 0", ">>", r) 7909 } 7910 x = 9223372036854775807 7911 y = 0 7912 r = x >> y 7913 if r != 9223372036854775807 { 7914 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", ">>", r) 7915 } 7916 y = 1 7917 r = x >> y 7918 if r != 4611686018427387903 { 7919 t.Errorf("9223372036854775807 %s 1 = %d, want 4611686018427387903", ">>", r) 7920 } 7921 y = 65535 7922 r = x >> y 7923 if r != 0 { 7924 t.Errorf("9223372036854775807 %s 65535 = %d, want 0", ">>", r) 7925 } 7926 } 7927 func TestConstFoldint64uint8lsh(t *testing.T) { 7928 var x, r int64 7929 var y uint8 7930 x = -9223372036854775808 7931 y = 0 7932 r = x << y 7933 if r != -9223372036854775808 { 7934 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "<<", r) 7935 } 7936 y = 1 7937 r = x << y 7938 if r != 0 { 7939 t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "<<", r) 7940 } 7941 y = 255 7942 r = x << y 7943 if r != 0 { 7944 t.Errorf("-9223372036854775808 %s 255 = %d, want 0", "<<", r) 7945 } 7946 x = -9223372036854775807 7947 y = 0 7948 r = x << y 7949 if r != -9223372036854775807 { 7950 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "<<", r) 7951 } 7952 y = 1 7953 r = x << y 7954 if r != 2 { 7955 t.Errorf("-9223372036854775807 %s 1 = %d, want 2", "<<", r) 7956 } 7957 y = 255 7958 r = x << y 7959 if r != 0 { 7960 t.Errorf("-9223372036854775807 %s 255 = %d, want 0", "<<", r) 7961 } 7962 x = -4294967296 7963 y = 0 7964 r = x << y 7965 if r != -4294967296 { 7966 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "<<", r) 7967 } 7968 y = 1 7969 r = x << y 7970 if r != -8589934592 { 7971 t.Errorf("-4294967296 %s 1 = %d, want -8589934592", "<<", r) 7972 } 7973 y = 255 7974 r = x << y 7975 if r != 0 { 7976 t.Errorf("-4294967296 %s 255 = %d, want 0", "<<", r) 7977 } 7978 x = -1 7979 y = 0 7980 r = x << y 7981 if r != -1 { 7982 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 7983 } 7984 y = 1 7985 r = x << y 7986 if r != -2 { 7987 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 7988 } 7989 y = 255 7990 r = x << y 7991 if r != 0 { 7992 t.Errorf("-1 %s 255 = %d, want 0", "<<", r) 7993 } 7994 x = 0 7995 y = 0 7996 r = x << y 7997 if r != 0 { 7998 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 7999 } 8000 y = 1 8001 r = x << y 8002 if r != 0 { 8003 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8004 } 8005 y = 255 8006 r = x << y 8007 if r != 0 { 8008 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 8009 } 8010 x = 1 8011 y = 0 8012 r = x << y 8013 if r != 1 { 8014 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8015 } 8016 y = 1 8017 r = x << y 8018 if r != 2 { 8019 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8020 } 8021 y = 255 8022 r = x << y 8023 if r != 0 { 8024 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 8025 } 8026 x = 4294967296 8027 y = 0 8028 r = x << y 8029 if r != 4294967296 { 8030 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 8031 } 8032 y = 1 8033 r = x << y 8034 if r != 8589934592 { 8035 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 8036 } 8037 y = 255 8038 r = x << y 8039 if r != 0 { 8040 t.Errorf("4294967296 %s 255 = %d, want 0", "<<", r) 8041 } 8042 x = 9223372036854775806 8043 y = 0 8044 r = x << y 8045 if r != 9223372036854775806 { 8046 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "<<", r) 8047 } 8048 y = 1 8049 r = x << y 8050 if r != -4 { 8051 t.Errorf("9223372036854775806 %s 1 = %d, want -4", "<<", r) 8052 } 8053 y = 255 8054 r = x << y 8055 if r != 0 { 8056 t.Errorf("9223372036854775806 %s 255 = %d, want 0", "<<", r) 8057 } 8058 x = 9223372036854775807 8059 y = 0 8060 r = x << y 8061 if r != 9223372036854775807 { 8062 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "<<", r) 8063 } 8064 y = 1 8065 r = x << y 8066 if r != -2 { 8067 t.Errorf("9223372036854775807 %s 1 = %d, want -2", "<<", r) 8068 } 8069 y = 255 8070 r = x << y 8071 if r != 0 { 8072 t.Errorf("9223372036854775807 %s 255 = %d, want 0", "<<", r) 8073 } 8074 } 8075 func TestConstFoldint64uint8rsh(t *testing.T) { 8076 var x, r int64 8077 var y uint8 8078 x = -9223372036854775808 8079 y = 0 8080 r = x >> y 8081 if r != -9223372036854775808 { 8082 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", ">>", r) 8083 } 8084 y = 1 8085 r = x >> y 8086 if r != -4611686018427387904 { 8087 t.Errorf("-9223372036854775808 %s 1 = %d, want -4611686018427387904", ">>", r) 8088 } 8089 y = 255 8090 r = x >> y 8091 if r != -1 { 8092 t.Errorf("-9223372036854775808 %s 255 = %d, want -1", ">>", r) 8093 } 8094 x = -9223372036854775807 8095 y = 0 8096 r = x >> y 8097 if r != -9223372036854775807 { 8098 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", ">>", r) 8099 } 8100 y = 1 8101 r = x >> y 8102 if r != -4611686018427387904 { 8103 t.Errorf("-9223372036854775807 %s 1 = %d, want -4611686018427387904", ">>", r) 8104 } 8105 y = 255 8106 r = x >> y 8107 if r != -1 { 8108 t.Errorf("-9223372036854775807 %s 255 = %d, want -1", ">>", r) 8109 } 8110 x = -4294967296 8111 y = 0 8112 r = x >> y 8113 if r != -4294967296 { 8114 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", ">>", r) 8115 } 8116 y = 1 8117 r = x >> y 8118 if r != -2147483648 { 8119 t.Errorf("-4294967296 %s 1 = %d, want -2147483648", ">>", r) 8120 } 8121 y = 255 8122 r = x >> y 8123 if r != -1 { 8124 t.Errorf("-4294967296 %s 255 = %d, want -1", ">>", r) 8125 } 8126 x = -1 8127 y = 0 8128 r = x >> y 8129 if r != -1 { 8130 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 8131 } 8132 y = 1 8133 r = x >> y 8134 if r != -1 { 8135 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 8136 } 8137 y = 255 8138 r = x >> y 8139 if r != -1 { 8140 t.Errorf("-1 %s 255 = %d, want -1", ">>", r) 8141 } 8142 x = 0 8143 y = 0 8144 r = x >> y 8145 if r != 0 { 8146 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8147 } 8148 y = 1 8149 r = x >> y 8150 if r != 0 { 8151 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8152 } 8153 y = 255 8154 r = x >> y 8155 if r != 0 { 8156 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 8157 } 8158 x = 1 8159 y = 0 8160 r = x >> y 8161 if r != 1 { 8162 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8163 } 8164 y = 1 8165 r = x >> y 8166 if r != 0 { 8167 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8168 } 8169 y = 255 8170 r = x >> y 8171 if r != 0 { 8172 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 8173 } 8174 x = 4294967296 8175 y = 0 8176 r = x >> y 8177 if r != 4294967296 { 8178 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 8179 } 8180 y = 1 8181 r = x >> y 8182 if r != 2147483648 { 8183 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 8184 } 8185 y = 255 8186 r = x >> y 8187 if r != 0 { 8188 t.Errorf("4294967296 %s 255 = %d, want 0", ">>", r) 8189 } 8190 x = 9223372036854775806 8191 y = 0 8192 r = x >> y 8193 if r != 9223372036854775806 { 8194 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", ">>", r) 8195 } 8196 y = 1 8197 r = x >> y 8198 if r != 4611686018427387903 { 8199 t.Errorf("9223372036854775806 %s 1 = %d, want 4611686018427387903", ">>", r) 8200 } 8201 y = 255 8202 r = x >> y 8203 if r != 0 { 8204 t.Errorf("9223372036854775806 %s 255 = %d, want 0", ">>", r) 8205 } 8206 x = 9223372036854775807 8207 y = 0 8208 r = x >> y 8209 if r != 9223372036854775807 { 8210 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", ">>", r) 8211 } 8212 y = 1 8213 r = x >> y 8214 if r != 4611686018427387903 { 8215 t.Errorf("9223372036854775807 %s 1 = %d, want 4611686018427387903", ">>", r) 8216 } 8217 y = 255 8218 r = x >> y 8219 if r != 0 { 8220 t.Errorf("9223372036854775807 %s 255 = %d, want 0", ">>", r) 8221 } 8222 } 8223 func TestConstFolduint32uint64lsh(t *testing.T) { 8224 var x, r uint32 8225 var y uint64 8226 x = 0 8227 y = 0 8228 r = x << y 8229 if r != 0 { 8230 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8231 } 8232 y = 1 8233 r = x << y 8234 if r != 0 { 8235 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8236 } 8237 y = 4294967296 8238 r = x << y 8239 if r != 0 { 8240 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 8241 } 8242 y = 18446744073709551615 8243 r = x << y 8244 if r != 0 { 8245 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 8246 } 8247 x = 1 8248 y = 0 8249 r = x << y 8250 if r != 1 { 8251 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8252 } 8253 y = 1 8254 r = x << y 8255 if r != 2 { 8256 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8257 } 8258 y = 4294967296 8259 r = x << y 8260 if r != 0 { 8261 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 8262 } 8263 y = 18446744073709551615 8264 r = x << y 8265 if r != 0 { 8266 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 8267 } 8268 x = 4294967295 8269 y = 0 8270 r = x << y 8271 if r != 4294967295 { 8272 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "<<", r) 8273 } 8274 y = 1 8275 r = x << y 8276 if r != 4294967294 { 8277 t.Errorf("4294967295 %s 1 = %d, want 4294967294", "<<", r) 8278 } 8279 y = 4294967296 8280 r = x << y 8281 if r != 0 { 8282 t.Errorf("4294967295 %s 4294967296 = %d, want 0", "<<", r) 8283 } 8284 y = 18446744073709551615 8285 r = x << y 8286 if r != 0 { 8287 t.Errorf("4294967295 %s 18446744073709551615 = %d, want 0", "<<", r) 8288 } 8289 } 8290 func TestConstFolduint32uint64rsh(t *testing.T) { 8291 var x, r uint32 8292 var y uint64 8293 x = 0 8294 y = 0 8295 r = x >> y 8296 if r != 0 { 8297 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8298 } 8299 y = 1 8300 r = x >> y 8301 if r != 0 { 8302 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8303 } 8304 y = 4294967296 8305 r = x >> y 8306 if r != 0 { 8307 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 8308 } 8309 y = 18446744073709551615 8310 r = x >> y 8311 if r != 0 { 8312 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 8313 } 8314 x = 1 8315 y = 0 8316 r = x >> y 8317 if r != 1 { 8318 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8319 } 8320 y = 1 8321 r = x >> y 8322 if r != 0 { 8323 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8324 } 8325 y = 4294967296 8326 r = x >> y 8327 if r != 0 { 8328 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 8329 } 8330 y = 18446744073709551615 8331 r = x >> y 8332 if r != 0 { 8333 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 8334 } 8335 x = 4294967295 8336 y = 0 8337 r = x >> y 8338 if r != 4294967295 { 8339 t.Errorf("4294967295 %s 0 = %d, want 4294967295", ">>", r) 8340 } 8341 y = 1 8342 r = x >> y 8343 if r != 2147483647 { 8344 t.Errorf("4294967295 %s 1 = %d, want 2147483647", ">>", r) 8345 } 8346 y = 4294967296 8347 r = x >> y 8348 if r != 0 { 8349 t.Errorf("4294967295 %s 4294967296 = %d, want 0", ">>", r) 8350 } 8351 y = 18446744073709551615 8352 r = x >> y 8353 if r != 0 { 8354 t.Errorf("4294967295 %s 18446744073709551615 = %d, want 0", ">>", r) 8355 } 8356 } 8357 func TestConstFolduint32uint32lsh(t *testing.T) { 8358 var x, r uint32 8359 var y uint32 8360 x = 0 8361 y = 0 8362 r = x << y 8363 if r != 0 { 8364 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8365 } 8366 y = 1 8367 r = x << y 8368 if r != 0 { 8369 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8370 } 8371 y = 4294967295 8372 r = x << y 8373 if r != 0 { 8374 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 8375 } 8376 x = 1 8377 y = 0 8378 r = x << y 8379 if r != 1 { 8380 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8381 } 8382 y = 1 8383 r = x << y 8384 if r != 2 { 8385 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8386 } 8387 y = 4294967295 8388 r = x << y 8389 if r != 0 { 8390 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 8391 } 8392 x = 4294967295 8393 y = 0 8394 r = x << y 8395 if r != 4294967295 { 8396 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "<<", r) 8397 } 8398 y = 1 8399 r = x << y 8400 if r != 4294967294 { 8401 t.Errorf("4294967295 %s 1 = %d, want 4294967294", "<<", r) 8402 } 8403 y = 4294967295 8404 r = x << y 8405 if r != 0 { 8406 t.Errorf("4294967295 %s 4294967295 = %d, want 0", "<<", r) 8407 } 8408 } 8409 func TestConstFolduint32uint32rsh(t *testing.T) { 8410 var x, r uint32 8411 var y uint32 8412 x = 0 8413 y = 0 8414 r = x >> y 8415 if r != 0 { 8416 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8417 } 8418 y = 1 8419 r = x >> y 8420 if r != 0 { 8421 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8422 } 8423 y = 4294967295 8424 r = x >> y 8425 if r != 0 { 8426 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 8427 } 8428 x = 1 8429 y = 0 8430 r = x >> y 8431 if r != 1 { 8432 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8433 } 8434 y = 1 8435 r = x >> y 8436 if r != 0 { 8437 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8438 } 8439 y = 4294967295 8440 r = x >> y 8441 if r != 0 { 8442 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 8443 } 8444 x = 4294967295 8445 y = 0 8446 r = x >> y 8447 if r != 4294967295 { 8448 t.Errorf("4294967295 %s 0 = %d, want 4294967295", ">>", r) 8449 } 8450 y = 1 8451 r = x >> y 8452 if r != 2147483647 { 8453 t.Errorf("4294967295 %s 1 = %d, want 2147483647", ">>", r) 8454 } 8455 y = 4294967295 8456 r = x >> y 8457 if r != 0 { 8458 t.Errorf("4294967295 %s 4294967295 = %d, want 0", ">>", r) 8459 } 8460 } 8461 func TestConstFolduint32uint16lsh(t *testing.T) { 8462 var x, r uint32 8463 var y uint16 8464 x = 0 8465 y = 0 8466 r = x << y 8467 if r != 0 { 8468 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8469 } 8470 y = 1 8471 r = x << y 8472 if r != 0 { 8473 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8474 } 8475 y = 65535 8476 r = x << y 8477 if r != 0 { 8478 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 8479 } 8480 x = 1 8481 y = 0 8482 r = x << y 8483 if r != 1 { 8484 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8485 } 8486 y = 1 8487 r = x << y 8488 if r != 2 { 8489 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8490 } 8491 y = 65535 8492 r = x << y 8493 if r != 0 { 8494 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 8495 } 8496 x = 4294967295 8497 y = 0 8498 r = x << y 8499 if r != 4294967295 { 8500 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "<<", r) 8501 } 8502 y = 1 8503 r = x << y 8504 if r != 4294967294 { 8505 t.Errorf("4294967295 %s 1 = %d, want 4294967294", "<<", r) 8506 } 8507 y = 65535 8508 r = x << y 8509 if r != 0 { 8510 t.Errorf("4294967295 %s 65535 = %d, want 0", "<<", r) 8511 } 8512 } 8513 func TestConstFolduint32uint16rsh(t *testing.T) { 8514 var x, r uint32 8515 var y uint16 8516 x = 0 8517 y = 0 8518 r = x >> y 8519 if r != 0 { 8520 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8521 } 8522 y = 1 8523 r = x >> y 8524 if r != 0 { 8525 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8526 } 8527 y = 65535 8528 r = x >> y 8529 if r != 0 { 8530 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 8531 } 8532 x = 1 8533 y = 0 8534 r = x >> y 8535 if r != 1 { 8536 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8537 } 8538 y = 1 8539 r = x >> y 8540 if r != 0 { 8541 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8542 } 8543 y = 65535 8544 r = x >> y 8545 if r != 0 { 8546 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 8547 } 8548 x = 4294967295 8549 y = 0 8550 r = x >> y 8551 if r != 4294967295 { 8552 t.Errorf("4294967295 %s 0 = %d, want 4294967295", ">>", r) 8553 } 8554 y = 1 8555 r = x >> y 8556 if r != 2147483647 { 8557 t.Errorf("4294967295 %s 1 = %d, want 2147483647", ">>", r) 8558 } 8559 y = 65535 8560 r = x >> y 8561 if r != 0 { 8562 t.Errorf("4294967295 %s 65535 = %d, want 0", ">>", r) 8563 } 8564 } 8565 func TestConstFolduint32uint8lsh(t *testing.T) { 8566 var x, r uint32 8567 var y uint8 8568 x = 0 8569 y = 0 8570 r = x << y 8571 if r != 0 { 8572 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8573 } 8574 y = 1 8575 r = x << y 8576 if r != 0 { 8577 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8578 } 8579 y = 255 8580 r = x << y 8581 if r != 0 { 8582 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 8583 } 8584 x = 1 8585 y = 0 8586 r = x << y 8587 if r != 1 { 8588 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8589 } 8590 y = 1 8591 r = x << y 8592 if r != 2 { 8593 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8594 } 8595 y = 255 8596 r = x << y 8597 if r != 0 { 8598 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 8599 } 8600 x = 4294967295 8601 y = 0 8602 r = x << y 8603 if r != 4294967295 { 8604 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "<<", r) 8605 } 8606 y = 1 8607 r = x << y 8608 if r != 4294967294 { 8609 t.Errorf("4294967295 %s 1 = %d, want 4294967294", "<<", r) 8610 } 8611 y = 255 8612 r = x << y 8613 if r != 0 { 8614 t.Errorf("4294967295 %s 255 = %d, want 0", "<<", r) 8615 } 8616 } 8617 func TestConstFolduint32uint8rsh(t *testing.T) { 8618 var x, r uint32 8619 var y uint8 8620 x = 0 8621 y = 0 8622 r = x >> y 8623 if r != 0 { 8624 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8625 } 8626 y = 1 8627 r = x >> y 8628 if r != 0 { 8629 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8630 } 8631 y = 255 8632 r = x >> y 8633 if r != 0 { 8634 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 8635 } 8636 x = 1 8637 y = 0 8638 r = x >> y 8639 if r != 1 { 8640 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8641 } 8642 y = 1 8643 r = x >> y 8644 if r != 0 { 8645 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8646 } 8647 y = 255 8648 r = x >> y 8649 if r != 0 { 8650 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 8651 } 8652 x = 4294967295 8653 y = 0 8654 r = x >> y 8655 if r != 4294967295 { 8656 t.Errorf("4294967295 %s 0 = %d, want 4294967295", ">>", r) 8657 } 8658 y = 1 8659 r = x >> y 8660 if r != 2147483647 { 8661 t.Errorf("4294967295 %s 1 = %d, want 2147483647", ">>", r) 8662 } 8663 y = 255 8664 r = x >> y 8665 if r != 0 { 8666 t.Errorf("4294967295 %s 255 = %d, want 0", ">>", r) 8667 } 8668 } 8669 func TestConstFoldint32uint64lsh(t *testing.T) { 8670 var x, r int32 8671 var y uint64 8672 x = -2147483648 8673 y = 0 8674 r = x << y 8675 if r != -2147483648 { 8676 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "<<", r) 8677 } 8678 y = 1 8679 r = x << y 8680 if r != 0 { 8681 t.Errorf("-2147483648 %s 1 = %d, want 0", "<<", r) 8682 } 8683 y = 4294967296 8684 r = x << y 8685 if r != 0 { 8686 t.Errorf("-2147483648 %s 4294967296 = %d, want 0", "<<", r) 8687 } 8688 y = 18446744073709551615 8689 r = x << y 8690 if r != 0 { 8691 t.Errorf("-2147483648 %s 18446744073709551615 = %d, want 0", "<<", r) 8692 } 8693 x = -2147483647 8694 y = 0 8695 r = x << y 8696 if r != -2147483647 { 8697 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "<<", r) 8698 } 8699 y = 1 8700 r = x << y 8701 if r != 2 { 8702 t.Errorf("-2147483647 %s 1 = %d, want 2", "<<", r) 8703 } 8704 y = 4294967296 8705 r = x << y 8706 if r != 0 { 8707 t.Errorf("-2147483647 %s 4294967296 = %d, want 0", "<<", r) 8708 } 8709 y = 18446744073709551615 8710 r = x << y 8711 if r != 0 { 8712 t.Errorf("-2147483647 %s 18446744073709551615 = %d, want 0", "<<", r) 8713 } 8714 x = -1 8715 y = 0 8716 r = x << y 8717 if r != -1 { 8718 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 8719 } 8720 y = 1 8721 r = x << y 8722 if r != -2 { 8723 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 8724 } 8725 y = 4294967296 8726 r = x << y 8727 if r != 0 { 8728 t.Errorf("-1 %s 4294967296 = %d, want 0", "<<", r) 8729 } 8730 y = 18446744073709551615 8731 r = x << y 8732 if r != 0 { 8733 t.Errorf("-1 %s 18446744073709551615 = %d, want 0", "<<", r) 8734 } 8735 x = 0 8736 y = 0 8737 r = x << y 8738 if r != 0 { 8739 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8740 } 8741 y = 1 8742 r = x << y 8743 if r != 0 { 8744 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8745 } 8746 y = 4294967296 8747 r = x << y 8748 if r != 0 { 8749 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 8750 } 8751 y = 18446744073709551615 8752 r = x << y 8753 if r != 0 { 8754 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 8755 } 8756 x = 1 8757 y = 0 8758 r = x << y 8759 if r != 1 { 8760 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8761 } 8762 y = 1 8763 r = x << y 8764 if r != 2 { 8765 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8766 } 8767 y = 4294967296 8768 r = x << y 8769 if r != 0 { 8770 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 8771 } 8772 y = 18446744073709551615 8773 r = x << y 8774 if r != 0 { 8775 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 8776 } 8777 x = 2147483647 8778 y = 0 8779 r = x << y 8780 if r != 2147483647 { 8781 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "<<", r) 8782 } 8783 y = 1 8784 r = x << y 8785 if r != -2 { 8786 t.Errorf("2147483647 %s 1 = %d, want -2", "<<", r) 8787 } 8788 y = 4294967296 8789 r = x << y 8790 if r != 0 { 8791 t.Errorf("2147483647 %s 4294967296 = %d, want 0", "<<", r) 8792 } 8793 y = 18446744073709551615 8794 r = x << y 8795 if r != 0 { 8796 t.Errorf("2147483647 %s 18446744073709551615 = %d, want 0", "<<", r) 8797 } 8798 } 8799 func TestConstFoldint32uint64rsh(t *testing.T) { 8800 var x, r int32 8801 var y uint64 8802 x = -2147483648 8803 y = 0 8804 r = x >> y 8805 if r != -2147483648 { 8806 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", ">>", r) 8807 } 8808 y = 1 8809 r = x >> y 8810 if r != -1073741824 { 8811 t.Errorf("-2147483648 %s 1 = %d, want -1073741824", ">>", r) 8812 } 8813 y = 4294967296 8814 r = x >> y 8815 if r != -1 { 8816 t.Errorf("-2147483648 %s 4294967296 = %d, want -1", ">>", r) 8817 } 8818 y = 18446744073709551615 8819 r = x >> y 8820 if r != -1 { 8821 t.Errorf("-2147483648 %s 18446744073709551615 = %d, want -1", ">>", r) 8822 } 8823 x = -2147483647 8824 y = 0 8825 r = x >> y 8826 if r != -2147483647 { 8827 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", ">>", r) 8828 } 8829 y = 1 8830 r = x >> y 8831 if r != -1073741824 { 8832 t.Errorf("-2147483647 %s 1 = %d, want -1073741824", ">>", r) 8833 } 8834 y = 4294967296 8835 r = x >> y 8836 if r != -1 { 8837 t.Errorf("-2147483647 %s 4294967296 = %d, want -1", ">>", r) 8838 } 8839 y = 18446744073709551615 8840 r = x >> y 8841 if r != -1 { 8842 t.Errorf("-2147483647 %s 18446744073709551615 = %d, want -1", ">>", r) 8843 } 8844 x = -1 8845 y = 0 8846 r = x >> y 8847 if r != -1 { 8848 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 8849 } 8850 y = 1 8851 r = x >> y 8852 if r != -1 { 8853 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 8854 } 8855 y = 4294967296 8856 r = x >> y 8857 if r != -1 { 8858 t.Errorf("-1 %s 4294967296 = %d, want -1", ">>", r) 8859 } 8860 y = 18446744073709551615 8861 r = x >> y 8862 if r != -1 { 8863 t.Errorf("-1 %s 18446744073709551615 = %d, want -1", ">>", r) 8864 } 8865 x = 0 8866 y = 0 8867 r = x >> y 8868 if r != 0 { 8869 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8870 } 8871 y = 1 8872 r = x >> y 8873 if r != 0 { 8874 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8875 } 8876 y = 4294967296 8877 r = x >> y 8878 if r != 0 { 8879 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 8880 } 8881 y = 18446744073709551615 8882 r = x >> y 8883 if r != 0 { 8884 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 8885 } 8886 x = 1 8887 y = 0 8888 r = x >> y 8889 if r != 1 { 8890 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8891 } 8892 y = 1 8893 r = x >> y 8894 if r != 0 { 8895 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8896 } 8897 y = 4294967296 8898 r = x >> y 8899 if r != 0 { 8900 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 8901 } 8902 y = 18446744073709551615 8903 r = x >> y 8904 if r != 0 { 8905 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 8906 } 8907 x = 2147483647 8908 y = 0 8909 r = x >> y 8910 if r != 2147483647 { 8911 t.Errorf("2147483647 %s 0 = %d, want 2147483647", ">>", r) 8912 } 8913 y = 1 8914 r = x >> y 8915 if r != 1073741823 { 8916 t.Errorf("2147483647 %s 1 = %d, want 1073741823", ">>", r) 8917 } 8918 y = 4294967296 8919 r = x >> y 8920 if r != 0 { 8921 t.Errorf("2147483647 %s 4294967296 = %d, want 0", ">>", r) 8922 } 8923 y = 18446744073709551615 8924 r = x >> y 8925 if r != 0 { 8926 t.Errorf("2147483647 %s 18446744073709551615 = %d, want 0", ">>", r) 8927 } 8928 } 8929 func TestConstFoldint32uint32lsh(t *testing.T) { 8930 var x, r int32 8931 var y uint32 8932 x = -2147483648 8933 y = 0 8934 r = x << y 8935 if r != -2147483648 { 8936 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "<<", r) 8937 } 8938 y = 1 8939 r = x << y 8940 if r != 0 { 8941 t.Errorf("-2147483648 %s 1 = %d, want 0", "<<", r) 8942 } 8943 y = 4294967295 8944 r = x << y 8945 if r != 0 { 8946 t.Errorf("-2147483648 %s 4294967295 = %d, want 0", "<<", r) 8947 } 8948 x = -2147483647 8949 y = 0 8950 r = x << y 8951 if r != -2147483647 { 8952 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "<<", r) 8953 } 8954 y = 1 8955 r = x << y 8956 if r != 2 { 8957 t.Errorf("-2147483647 %s 1 = %d, want 2", "<<", r) 8958 } 8959 y = 4294967295 8960 r = x << y 8961 if r != 0 { 8962 t.Errorf("-2147483647 %s 4294967295 = %d, want 0", "<<", r) 8963 } 8964 x = -1 8965 y = 0 8966 r = x << y 8967 if r != -1 { 8968 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 8969 } 8970 y = 1 8971 r = x << y 8972 if r != -2 { 8973 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 8974 } 8975 y = 4294967295 8976 r = x << y 8977 if r != 0 { 8978 t.Errorf("-1 %s 4294967295 = %d, want 0", "<<", r) 8979 } 8980 x = 0 8981 y = 0 8982 r = x << y 8983 if r != 0 { 8984 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8985 } 8986 y = 1 8987 r = x << y 8988 if r != 0 { 8989 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8990 } 8991 y = 4294967295 8992 r = x << y 8993 if r != 0 { 8994 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 8995 } 8996 x = 1 8997 y = 0 8998 r = x << y 8999 if r != 1 { 9000 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9001 } 9002 y = 1 9003 r = x << y 9004 if r != 2 { 9005 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9006 } 9007 y = 4294967295 9008 r = x << y 9009 if r != 0 { 9010 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 9011 } 9012 x = 2147483647 9013 y = 0 9014 r = x << y 9015 if r != 2147483647 { 9016 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "<<", r) 9017 } 9018 y = 1 9019 r = x << y 9020 if r != -2 { 9021 t.Errorf("2147483647 %s 1 = %d, want -2", "<<", r) 9022 } 9023 y = 4294967295 9024 r = x << y 9025 if r != 0 { 9026 t.Errorf("2147483647 %s 4294967295 = %d, want 0", "<<", r) 9027 } 9028 } 9029 func TestConstFoldint32uint32rsh(t *testing.T) { 9030 var x, r int32 9031 var y uint32 9032 x = -2147483648 9033 y = 0 9034 r = x >> y 9035 if r != -2147483648 { 9036 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", ">>", r) 9037 } 9038 y = 1 9039 r = x >> y 9040 if r != -1073741824 { 9041 t.Errorf("-2147483648 %s 1 = %d, want -1073741824", ">>", r) 9042 } 9043 y = 4294967295 9044 r = x >> y 9045 if r != -1 { 9046 t.Errorf("-2147483648 %s 4294967295 = %d, want -1", ">>", r) 9047 } 9048 x = -2147483647 9049 y = 0 9050 r = x >> y 9051 if r != -2147483647 { 9052 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", ">>", r) 9053 } 9054 y = 1 9055 r = x >> y 9056 if r != -1073741824 { 9057 t.Errorf("-2147483647 %s 1 = %d, want -1073741824", ">>", r) 9058 } 9059 y = 4294967295 9060 r = x >> y 9061 if r != -1 { 9062 t.Errorf("-2147483647 %s 4294967295 = %d, want -1", ">>", r) 9063 } 9064 x = -1 9065 y = 0 9066 r = x >> y 9067 if r != -1 { 9068 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 9069 } 9070 y = 1 9071 r = x >> y 9072 if r != -1 { 9073 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 9074 } 9075 y = 4294967295 9076 r = x >> y 9077 if r != -1 { 9078 t.Errorf("-1 %s 4294967295 = %d, want -1", ">>", r) 9079 } 9080 x = 0 9081 y = 0 9082 r = x >> y 9083 if r != 0 { 9084 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9085 } 9086 y = 1 9087 r = x >> y 9088 if r != 0 { 9089 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9090 } 9091 y = 4294967295 9092 r = x >> y 9093 if r != 0 { 9094 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 9095 } 9096 x = 1 9097 y = 0 9098 r = x >> y 9099 if r != 1 { 9100 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9101 } 9102 y = 1 9103 r = x >> y 9104 if r != 0 { 9105 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9106 } 9107 y = 4294967295 9108 r = x >> y 9109 if r != 0 { 9110 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 9111 } 9112 x = 2147483647 9113 y = 0 9114 r = x >> y 9115 if r != 2147483647 { 9116 t.Errorf("2147483647 %s 0 = %d, want 2147483647", ">>", r) 9117 } 9118 y = 1 9119 r = x >> y 9120 if r != 1073741823 { 9121 t.Errorf("2147483647 %s 1 = %d, want 1073741823", ">>", r) 9122 } 9123 y = 4294967295 9124 r = x >> y 9125 if r != 0 { 9126 t.Errorf("2147483647 %s 4294967295 = %d, want 0", ">>", r) 9127 } 9128 } 9129 func TestConstFoldint32uint16lsh(t *testing.T) { 9130 var x, r int32 9131 var y uint16 9132 x = -2147483648 9133 y = 0 9134 r = x << y 9135 if r != -2147483648 { 9136 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "<<", r) 9137 } 9138 y = 1 9139 r = x << y 9140 if r != 0 { 9141 t.Errorf("-2147483648 %s 1 = %d, want 0", "<<", r) 9142 } 9143 y = 65535 9144 r = x << y 9145 if r != 0 { 9146 t.Errorf("-2147483648 %s 65535 = %d, want 0", "<<", r) 9147 } 9148 x = -2147483647 9149 y = 0 9150 r = x << y 9151 if r != -2147483647 { 9152 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "<<", r) 9153 } 9154 y = 1 9155 r = x << y 9156 if r != 2 { 9157 t.Errorf("-2147483647 %s 1 = %d, want 2", "<<", r) 9158 } 9159 y = 65535 9160 r = x << y 9161 if r != 0 { 9162 t.Errorf("-2147483647 %s 65535 = %d, want 0", "<<", r) 9163 } 9164 x = -1 9165 y = 0 9166 r = x << y 9167 if r != -1 { 9168 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 9169 } 9170 y = 1 9171 r = x << y 9172 if r != -2 { 9173 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 9174 } 9175 y = 65535 9176 r = x << y 9177 if r != 0 { 9178 t.Errorf("-1 %s 65535 = %d, want 0", "<<", r) 9179 } 9180 x = 0 9181 y = 0 9182 r = x << y 9183 if r != 0 { 9184 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9185 } 9186 y = 1 9187 r = x << y 9188 if r != 0 { 9189 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9190 } 9191 y = 65535 9192 r = x << y 9193 if r != 0 { 9194 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 9195 } 9196 x = 1 9197 y = 0 9198 r = x << y 9199 if r != 1 { 9200 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9201 } 9202 y = 1 9203 r = x << y 9204 if r != 2 { 9205 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9206 } 9207 y = 65535 9208 r = x << y 9209 if r != 0 { 9210 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 9211 } 9212 x = 2147483647 9213 y = 0 9214 r = x << y 9215 if r != 2147483647 { 9216 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "<<", r) 9217 } 9218 y = 1 9219 r = x << y 9220 if r != -2 { 9221 t.Errorf("2147483647 %s 1 = %d, want -2", "<<", r) 9222 } 9223 y = 65535 9224 r = x << y 9225 if r != 0 { 9226 t.Errorf("2147483647 %s 65535 = %d, want 0", "<<", r) 9227 } 9228 } 9229 func TestConstFoldint32uint16rsh(t *testing.T) { 9230 var x, r int32 9231 var y uint16 9232 x = -2147483648 9233 y = 0 9234 r = x >> y 9235 if r != -2147483648 { 9236 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", ">>", r) 9237 } 9238 y = 1 9239 r = x >> y 9240 if r != -1073741824 { 9241 t.Errorf("-2147483648 %s 1 = %d, want -1073741824", ">>", r) 9242 } 9243 y = 65535 9244 r = x >> y 9245 if r != -1 { 9246 t.Errorf("-2147483648 %s 65535 = %d, want -1", ">>", r) 9247 } 9248 x = -2147483647 9249 y = 0 9250 r = x >> y 9251 if r != -2147483647 { 9252 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", ">>", r) 9253 } 9254 y = 1 9255 r = x >> y 9256 if r != -1073741824 { 9257 t.Errorf("-2147483647 %s 1 = %d, want -1073741824", ">>", r) 9258 } 9259 y = 65535 9260 r = x >> y 9261 if r != -1 { 9262 t.Errorf("-2147483647 %s 65535 = %d, want -1", ">>", r) 9263 } 9264 x = -1 9265 y = 0 9266 r = x >> y 9267 if r != -1 { 9268 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 9269 } 9270 y = 1 9271 r = x >> y 9272 if r != -1 { 9273 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 9274 } 9275 y = 65535 9276 r = x >> y 9277 if r != -1 { 9278 t.Errorf("-1 %s 65535 = %d, want -1", ">>", r) 9279 } 9280 x = 0 9281 y = 0 9282 r = x >> y 9283 if r != 0 { 9284 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9285 } 9286 y = 1 9287 r = x >> y 9288 if r != 0 { 9289 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9290 } 9291 y = 65535 9292 r = x >> y 9293 if r != 0 { 9294 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 9295 } 9296 x = 1 9297 y = 0 9298 r = x >> y 9299 if r != 1 { 9300 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9301 } 9302 y = 1 9303 r = x >> y 9304 if r != 0 { 9305 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9306 } 9307 y = 65535 9308 r = x >> y 9309 if r != 0 { 9310 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 9311 } 9312 x = 2147483647 9313 y = 0 9314 r = x >> y 9315 if r != 2147483647 { 9316 t.Errorf("2147483647 %s 0 = %d, want 2147483647", ">>", r) 9317 } 9318 y = 1 9319 r = x >> y 9320 if r != 1073741823 { 9321 t.Errorf("2147483647 %s 1 = %d, want 1073741823", ">>", r) 9322 } 9323 y = 65535 9324 r = x >> y 9325 if r != 0 { 9326 t.Errorf("2147483647 %s 65535 = %d, want 0", ">>", r) 9327 } 9328 } 9329 func TestConstFoldint32uint8lsh(t *testing.T) { 9330 var x, r int32 9331 var y uint8 9332 x = -2147483648 9333 y = 0 9334 r = x << y 9335 if r != -2147483648 { 9336 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "<<", r) 9337 } 9338 y = 1 9339 r = x << y 9340 if r != 0 { 9341 t.Errorf("-2147483648 %s 1 = %d, want 0", "<<", r) 9342 } 9343 y = 255 9344 r = x << y 9345 if r != 0 { 9346 t.Errorf("-2147483648 %s 255 = %d, want 0", "<<", r) 9347 } 9348 x = -2147483647 9349 y = 0 9350 r = x << y 9351 if r != -2147483647 { 9352 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "<<", r) 9353 } 9354 y = 1 9355 r = x << y 9356 if r != 2 { 9357 t.Errorf("-2147483647 %s 1 = %d, want 2", "<<", r) 9358 } 9359 y = 255 9360 r = x << y 9361 if r != 0 { 9362 t.Errorf("-2147483647 %s 255 = %d, want 0", "<<", r) 9363 } 9364 x = -1 9365 y = 0 9366 r = x << y 9367 if r != -1 { 9368 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 9369 } 9370 y = 1 9371 r = x << y 9372 if r != -2 { 9373 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 9374 } 9375 y = 255 9376 r = x << y 9377 if r != 0 { 9378 t.Errorf("-1 %s 255 = %d, want 0", "<<", r) 9379 } 9380 x = 0 9381 y = 0 9382 r = x << y 9383 if r != 0 { 9384 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9385 } 9386 y = 1 9387 r = x << y 9388 if r != 0 { 9389 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9390 } 9391 y = 255 9392 r = x << y 9393 if r != 0 { 9394 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 9395 } 9396 x = 1 9397 y = 0 9398 r = x << y 9399 if r != 1 { 9400 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9401 } 9402 y = 1 9403 r = x << y 9404 if r != 2 { 9405 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9406 } 9407 y = 255 9408 r = x << y 9409 if r != 0 { 9410 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 9411 } 9412 x = 2147483647 9413 y = 0 9414 r = x << y 9415 if r != 2147483647 { 9416 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "<<", r) 9417 } 9418 y = 1 9419 r = x << y 9420 if r != -2 { 9421 t.Errorf("2147483647 %s 1 = %d, want -2", "<<", r) 9422 } 9423 y = 255 9424 r = x << y 9425 if r != 0 { 9426 t.Errorf("2147483647 %s 255 = %d, want 0", "<<", r) 9427 } 9428 } 9429 func TestConstFoldint32uint8rsh(t *testing.T) { 9430 var x, r int32 9431 var y uint8 9432 x = -2147483648 9433 y = 0 9434 r = x >> y 9435 if r != -2147483648 { 9436 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", ">>", r) 9437 } 9438 y = 1 9439 r = x >> y 9440 if r != -1073741824 { 9441 t.Errorf("-2147483648 %s 1 = %d, want -1073741824", ">>", r) 9442 } 9443 y = 255 9444 r = x >> y 9445 if r != -1 { 9446 t.Errorf("-2147483648 %s 255 = %d, want -1", ">>", r) 9447 } 9448 x = -2147483647 9449 y = 0 9450 r = x >> y 9451 if r != -2147483647 { 9452 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", ">>", r) 9453 } 9454 y = 1 9455 r = x >> y 9456 if r != -1073741824 { 9457 t.Errorf("-2147483647 %s 1 = %d, want -1073741824", ">>", r) 9458 } 9459 y = 255 9460 r = x >> y 9461 if r != -1 { 9462 t.Errorf("-2147483647 %s 255 = %d, want -1", ">>", r) 9463 } 9464 x = -1 9465 y = 0 9466 r = x >> y 9467 if r != -1 { 9468 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 9469 } 9470 y = 1 9471 r = x >> y 9472 if r != -1 { 9473 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 9474 } 9475 y = 255 9476 r = x >> y 9477 if r != -1 { 9478 t.Errorf("-1 %s 255 = %d, want -1", ">>", r) 9479 } 9480 x = 0 9481 y = 0 9482 r = x >> y 9483 if r != 0 { 9484 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9485 } 9486 y = 1 9487 r = x >> y 9488 if r != 0 { 9489 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9490 } 9491 y = 255 9492 r = x >> y 9493 if r != 0 { 9494 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 9495 } 9496 x = 1 9497 y = 0 9498 r = x >> y 9499 if r != 1 { 9500 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9501 } 9502 y = 1 9503 r = x >> y 9504 if r != 0 { 9505 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9506 } 9507 y = 255 9508 r = x >> y 9509 if r != 0 { 9510 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 9511 } 9512 x = 2147483647 9513 y = 0 9514 r = x >> y 9515 if r != 2147483647 { 9516 t.Errorf("2147483647 %s 0 = %d, want 2147483647", ">>", r) 9517 } 9518 y = 1 9519 r = x >> y 9520 if r != 1073741823 { 9521 t.Errorf("2147483647 %s 1 = %d, want 1073741823", ">>", r) 9522 } 9523 y = 255 9524 r = x >> y 9525 if r != 0 { 9526 t.Errorf("2147483647 %s 255 = %d, want 0", ">>", r) 9527 } 9528 } 9529 func TestConstFolduint16uint64lsh(t *testing.T) { 9530 var x, r uint16 9531 var y uint64 9532 x = 0 9533 y = 0 9534 r = x << y 9535 if r != 0 { 9536 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9537 } 9538 y = 1 9539 r = x << y 9540 if r != 0 { 9541 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9542 } 9543 y = 4294967296 9544 r = x << y 9545 if r != 0 { 9546 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 9547 } 9548 y = 18446744073709551615 9549 r = x << y 9550 if r != 0 { 9551 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 9552 } 9553 x = 1 9554 y = 0 9555 r = x << y 9556 if r != 1 { 9557 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9558 } 9559 y = 1 9560 r = x << y 9561 if r != 2 { 9562 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9563 } 9564 y = 4294967296 9565 r = x << y 9566 if r != 0 { 9567 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 9568 } 9569 y = 18446744073709551615 9570 r = x << y 9571 if r != 0 { 9572 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 9573 } 9574 x = 65535 9575 y = 0 9576 r = x << y 9577 if r != 65535 { 9578 t.Errorf("65535 %s 0 = %d, want 65535", "<<", r) 9579 } 9580 y = 1 9581 r = x << y 9582 if r != 65534 { 9583 t.Errorf("65535 %s 1 = %d, want 65534", "<<", r) 9584 } 9585 y = 4294967296 9586 r = x << y 9587 if r != 0 { 9588 t.Errorf("65535 %s 4294967296 = %d, want 0", "<<", r) 9589 } 9590 y = 18446744073709551615 9591 r = x << y 9592 if r != 0 { 9593 t.Errorf("65535 %s 18446744073709551615 = %d, want 0", "<<", r) 9594 } 9595 } 9596 func TestConstFolduint16uint64rsh(t *testing.T) { 9597 var x, r uint16 9598 var y uint64 9599 x = 0 9600 y = 0 9601 r = x >> y 9602 if r != 0 { 9603 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9604 } 9605 y = 1 9606 r = x >> y 9607 if r != 0 { 9608 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9609 } 9610 y = 4294967296 9611 r = x >> y 9612 if r != 0 { 9613 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 9614 } 9615 y = 18446744073709551615 9616 r = x >> y 9617 if r != 0 { 9618 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 9619 } 9620 x = 1 9621 y = 0 9622 r = x >> y 9623 if r != 1 { 9624 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9625 } 9626 y = 1 9627 r = x >> y 9628 if r != 0 { 9629 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9630 } 9631 y = 4294967296 9632 r = x >> y 9633 if r != 0 { 9634 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 9635 } 9636 y = 18446744073709551615 9637 r = x >> y 9638 if r != 0 { 9639 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 9640 } 9641 x = 65535 9642 y = 0 9643 r = x >> y 9644 if r != 65535 { 9645 t.Errorf("65535 %s 0 = %d, want 65535", ">>", r) 9646 } 9647 y = 1 9648 r = x >> y 9649 if r != 32767 { 9650 t.Errorf("65535 %s 1 = %d, want 32767", ">>", r) 9651 } 9652 y = 4294967296 9653 r = x >> y 9654 if r != 0 { 9655 t.Errorf("65535 %s 4294967296 = %d, want 0", ">>", r) 9656 } 9657 y = 18446744073709551615 9658 r = x >> y 9659 if r != 0 { 9660 t.Errorf("65535 %s 18446744073709551615 = %d, want 0", ">>", r) 9661 } 9662 } 9663 func TestConstFolduint16uint32lsh(t *testing.T) { 9664 var x, r uint16 9665 var y uint32 9666 x = 0 9667 y = 0 9668 r = x << y 9669 if r != 0 { 9670 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9671 } 9672 y = 1 9673 r = x << y 9674 if r != 0 { 9675 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9676 } 9677 y = 4294967295 9678 r = x << y 9679 if r != 0 { 9680 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 9681 } 9682 x = 1 9683 y = 0 9684 r = x << y 9685 if r != 1 { 9686 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9687 } 9688 y = 1 9689 r = x << y 9690 if r != 2 { 9691 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9692 } 9693 y = 4294967295 9694 r = x << y 9695 if r != 0 { 9696 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 9697 } 9698 x = 65535 9699 y = 0 9700 r = x << y 9701 if r != 65535 { 9702 t.Errorf("65535 %s 0 = %d, want 65535", "<<", r) 9703 } 9704 y = 1 9705 r = x << y 9706 if r != 65534 { 9707 t.Errorf("65535 %s 1 = %d, want 65534", "<<", r) 9708 } 9709 y = 4294967295 9710 r = x << y 9711 if r != 0 { 9712 t.Errorf("65535 %s 4294967295 = %d, want 0", "<<", r) 9713 } 9714 } 9715 func TestConstFolduint16uint32rsh(t *testing.T) { 9716 var x, r uint16 9717 var y uint32 9718 x = 0 9719 y = 0 9720 r = x >> y 9721 if r != 0 { 9722 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9723 } 9724 y = 1 9725 r = x >> y 9726 if r != 0 { 9727 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9728 } 9729 y = 4294967295 9730 r = x >> y 9731 if r != 0 { 9732 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 9733 } 9734 x = 1 9735 y = 0 9736 r = x >> y 9737 if r != 1 { 9738 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9739 } 9740 y = 1 9741 r = x >> y 9742 if r != 0 { 9743 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9744 } 9745 y = 4294967295 9746 r = x >> y 9747 if r != 0 { 9748 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 9749 } 9750 x = 65535 9751 y = 0 9752 r = x >> y 9753 if r != 65535 { 9754 t.Errorf("65535 %s 0 = %d, want 65535", ">>", r) 9755 } 9756 y = 1 9757 r = x >> y 9758 if r != 32767 { 9759 t.Errorf("65535 %s 1 = %d, want 32767", ">>", r) 9760 } 9761 y = 4294967295 9762 r = x >> y 9763 if r != 0 { 9764 t.Errorf("65535 %s 4294967295 = %d, want 0", ">>", r) 9765 } 9766 } 9767 func TestConstFolduint16uint16lsh(t *testing.T) { 9768 var x, r uint16 9769 var y uint16 9770 x = 0 9771 y = 0 9772 r = x << y 9773 if r != 0 { 9774 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9775 } 9776 y = 1 9777 r = x << y 9778 if r != 0 { 9779 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9780 } 9781 y = 65535 9782 r = x << y 9783 if r != 0 { 9784 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 9785 } 9786 x = 1 9787 y = 0 9788 r = x << y 9789 if r != 1 { 9790 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9791 } 9792 y = 1 9793 r = x << y 9794 if r != 2 { 9795 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9796 } 9797 y = 65535 9798 r = x << y 9799 if r != 0 { 9800 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 9801 } 9802 x = 65535 9803 y = 0 9804 r = x << y 9805 if r != 65535 { 9806 t.Errorf("65535 %s 0 = %d, want 65535", "<<", r) 9807 } 9808 y = 1 9809 r = x << y 9810 if r != 65534 { 9811 t.Errorf("65535 %s 1 = %d, want 65534", "<<", r) 9812 } 9813 y = 65535 9814 r = x << y 9815 if r != 0 { 9816 t.Errorf("65535 %s 65535 = %d, want 0", "<<", r) 9817 } 9818 } 9819 func TestConstFolduint16uint16rsh(t *testing.T) { 9820 var x, r uint16 9821 var y uint16 9822 x = 0 9823 y = 0 9824 r = x >> y 9825 if r != 0 { 9826 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9827 } 9828 y = 1 9829 r = x >> y 9830 if r != 0 { 9831 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9832 } 9833 y = 65535 9834 r = x >> y 9835 if r != 0 { 9836 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 9837 } 9838 x = 1 9839 y = 0 9840 r = x >> y 9841 if r != 1 { 9842 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9843 } 9844 y = 1 9845 r = x >> y 9846 if r != 0 { 9847 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9848 } 9849 y = 65535 9850 r = x >> y 9851 if r != 0 { 9852 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 9853 } 9854 x = 65535 9855 y = 0 9856 r = x >> y 9857 if r != 65535 { 9858 t.Errorf("65535 %s 0 = %d, want 65535", ">>", r) 9859 } 9860 y = 1 9861 r = x >> y 9862 if r != 32767 { 9863 t.Errorf("65535 %s 1 = %d, want 32767", ">>", r) 9864 } 9865 y = 65535 9866 r = x >> y 9867 if r != 0 { 9868 t.Errorf("65535 %s 65535 = %d, want 0", ">>", r) 9869 } 9870 } 9871 func TestConstFolduint16uint8lsh(t *testing.T) { 9872 var x, r uint16 9873 var y uint8 9874 x = 0 9875 y = 0 9876 r = x << y 9877 if r != 0 { 9878 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9879 } 9880 y = 1 9881 r = x << y 9882 if r != 0 { 9883 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9884 } 9885 y = 255 9886 r = x << y 9887 if r != 0 { 9888 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 9889 } 9890 x = 1 9891 y = 0 9892 r = x << y 9893 if r != 1 { 9894 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9895 } 9896 y = 1 9897 r = x << y 9898 if r != 2 { 9899 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9900 } 9901 y = 255 9902 r = x << y 9903 if r != 0 { 9904 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 9905 } 9906 x = 65535 9907 y = 0 9908 r = x << y 9909 if r != 65535 { 9910 t.Errorf("65535 %s 0 = %d, want 65535", "<<", r) 9911 } 9912 y = 1 9913 r = x << y 9914 if r != 65534 { 9915 t.Errorf("65535 %s 1 = %d, want 65534", "<<", r) 9916 } 9917 y = 255 9918 r = x << y 9919 if r != 0 { 9920 t.Errorf("65535 %s 255 = %d, want 0", "<<", r) 9921 } 9922 } 9923 func TestConstFolduint16uint8rsh(t *testing.T) { 9924 var x, r uint16 9925 var y uint8 9926 x = 0 9927 y = 0 9928 r = x >> y 9929 if r != 0 { 9930 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9931 } 9932 y = 1 9933 r = x >> y 9934 if r != 0 { 9935 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9936 } 9937 y = 255 9938 r = x >> y 9939 if r != 0 { 9940 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 9941 } 9942 x = 1 9943 y = 0 9944 r = x >> y 9945 if r != 1 { 9946 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9947 } 9948 y = 1 9949 r = x >> y 9950 if r != 0 { 9951 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9952 } 9953 y = 255 9954 r = x >> y 9955 if r != 0 { 9956 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 9957 } 9958 x = 65535 9959 y = 0 9960 r = x >> y 9961 if r != 65535 { 9962 t.Errorf("65535 %s 0 = %d, want 65535", ">>", r) 9963 } 9964 y = 1 9965 r = x >> y 9966 if r != 32767 { 9967 t.Errorf("65535 %s 1 = %d, want 32767", ">>", r) 9968 } 9969 y = 255 9970 r = x >> y 9971 if r != 0 { 9972 t.Errorf("65535 %s 255 = %d, want 0", ">>", r) 9973 } 9974 } 9975 func TestConstFoldint16uint64lsh(t *testing.T) { 9976 var x, r int16 9977 var y uint64 9978 x = -32768 9979 y = 0 9980 r = x << y 9981 if r != -32768 { 9982 t.Errorf("-32768 %s 0 = %d, want -32768", "<<", r) 9983 } 9984 y = 1 9985 r = x << y 9986 if r != 0 { 9987 t.Errorf("-32768 %s 1 = %d, want 0", "<<", r) 9988 } 9989 y = 4294967296 9990 r = x << y 9991 if r != 0 { 9992 t.Errorf("-32768 %s 4294967296 = %d, want 0", "<<", r) 9993 } 9994 y = 18446744073709551615 9995 r = x << y 9996 if r != 0 { 9997 t.Errorf("-32768 %s 18446744073709551615 = %d, want 0", "<<", r) 9998 } 9999 x = -32767 10000 y = 0 10001 r = x << y 10002 if r != -32767 { 10003 t.Errorf("-32767 %s 0 = %d, want -32767", "<<", r) 10004 } 10005 y = 1 10006 r = x << y 10007 if r != 2 { 10008 t.Errorf("-32767 %s 1 = %d, want 2", "<<", r) 10009 } 10010 y = 4294967296 10011 r = x << y 10012 if r != 0 { 10013 t.Errorf("-32767 %s 4294967296 = %d, want 0", "<<", r) 10014 } 10015 y = 18446744073709551615 10016 r = x << y 10017 if r != 0 { 10018 t.Errorf("-32767 %s 18446744073709551615 = %d, want 0", "<<", r) 10019 } 10020 x = -1 10021 y = 0 10022 r = x << y 10023 if r != -1 { 10024 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 10025 } 10026 y = 1 10027 r = x << y 10028 if r != -2 { 10029 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 10030 } 10031 y = 4294967296 10032 r = x << y 10033 if r != 0 { 10034 t.Errorf("-1 %s 4294967296 = %d, want 0", "<<", r) 10035 } 10036 y = 18446744073709551615 10037 r = x << y 10038 if r != 0 { 10039 t.Errorf("-1 %s 18446744073709551615 = %d, want 0", "<<", r) 10040 } 10041 x = 0 10042 y = 0 10043 r = x << y 10044 if r != 0 { 10045 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 10046 } 10047 y = 1 10048 r = x << y 10049 if r != 0 { 10050 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 10051 } 10052 y = 4294967296 10053 r = x << y 10054 if r != 0 { 10055 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 10056 } 10057 y = 18446744073709551615 10058 r = x << y 10059 if r != 0 { 10060 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 10061 } 10062 x = 1 10063 y = 0 10064 r = x << y 10065 if r != 1 { 10066 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 10067 } 10068 y = 1 10069 r = x << y 10070 if r != 2 { 10071 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 10072 } 10073 y = 4294967296 10074 r = x << y 10075 if r != 0 { 10076 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 10077 } 10078 y = 18446744073709551615 10079 r = x << y 10080 if r != 0 { 10081 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 10082 } 10083 x = 32766 10084 y = 0 10085 r = x << y 10086 if r != 32766 { 10087 t.Errorf("32766 %s 0 = %d, want 32766", "<<", r) 10088 } 10089 y = 1 10090 r = x << y 10091 if r != -4 { 10092 t.Errorf("32766 %s 1 = %d, want -4", "<<", r) 10093 } 10094 y = 4294967296 10095 r = x << y 10096 if r != 0 { 10097 t.Errorf("32766 %s 4294967296 = %d, want 0", "<<", r) 10098 } 10099 y = 18446744073709551615 10100 r = x << y 10101 if r != 0 { 10102 t.Errorf("32766 %s 18446744073709551615 = %d, want 0", "<<", r) 10103 } 10104 x = 32767 10105 y = 0 10106 r = x << y 10107 if r != 32767 { 10108 t.Errorf("32767 %s 0 = %d, want 32767", "<<", r) 10109 } 10110 y = 1 10111 r = x << y 10112 if r != -2 { 10113 t.Errorf("32767 %s 1 = %d, want -2", "<<", r) 10114 } 10115 y = 4294967296 10116 r = x << y 10117 if r != 0 { 10118 t.Errorf("32767 %s 4294967296 = %d, want 0", "<<", r) 10119 } 10120 y = 18446744073709551615 10121 r = x << y 10122 if r != 0 { 10123 t.Errorf("32767 %s 18446744073709551615 = %d, want 0", "<<", r) 10124 } 10125 } 10126 func TestConstFoldint16uint64rsh(t *testing.T) { 10127 var x, r int16 10128 var y uint64 10129 x = -32768 10130 y = 0 10131 r = x >> y 10132 if r != -32768 { 10133 t.Errorf("-32768 %s 0 = %d, want -32768", ">>", r) 10134 } 10135 y = 1 10136 r = x >> y 10137 if r != -16384 { 10138 t.Errorf("-32768 %s 1 = %d, want -16384", ">>", r) 10139 } 10140 y = 4294967296 10141 r = x >> y 10142 if r != -1 { 10143 t.Errorf("-32768 %s 4294967296 = %d, want -1", ">>", r) 10144 } 10145 y = 18446744073709551615 10146 r = x >> y 10147 if r != -1 { 10148 t.Errorf("-32768 %s 18446744073709551615 = %d, want -1", ">>", r) 10149 } 10150 x = -32767 10151 y = 0 10152 r = x >> y 10153 if r != -32767 { 10154 t.Errorf("-32767 %s 0 = %d, want -32767", ">>", r) 10155 } 10156 y = 1 10157 r = x >> y 10158 if r != -16384 { 10159 t.Errorf("-32767 %s 1 = %d, want -16384", ">>", r) 10160 } 10161 y = 4294967296 10162 r = x >> y 10163 if r != -1 { 10164 t.Errorf("-32767 %s 4294967296 = %d, want -1", ">>", r) 10165 } 10166 y = 18446744073709551615 10167 r = x >> y 10168 if r != -1 { 10169 t.Errorf("-32767 %s 18446744073709551615 = %d, want -1", ">>", r) 10170 } 10171 x = -1 10172 y = 0 10173 r = x >> y 10174 if r != -1 { 10175 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 10176 } 10177 y = 1 10178 r = x >> y 10179 if r != -1 { 10180 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 10181 } 10182 y = 4294967296 10183 r = x >> y 10184 if r != -1 { 10185 t.Errorf("-1 %s 4294967296 = %d, want -1", ">>", r) 10186 } 10187 y = 18446744073709551615 10188 r = x >> y 10189 if r != -1 { 10190 t.Errorf("-1 %s 18446744073709551615 = %d, want -1", ">>", r) 10191 } 10192 x = 0 10193 y = 0 10194 r = x >> y 10195 if r != 0 { 10196 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 10197 } 10198 y = 1 10199 r = x >> y 10200 if r != 0 { 10201 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 10202 } 10203 y = 4294967296 10204 r = x >> y 10205 if r != 0 { 10206 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 10207 } 10208 y = 18446744073709551615 10209 r = x >> y 10210 if r != 0 { 10211 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 10212 } 10213 x = 1 10214 y = 0 10215 r = x >> y 10216 if r != 1 { 10217 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 10218 } 10219 y = 1 10220 r = x >> y 10221 if r != 0 { 10222 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 10223 } 10224 y = 4294967296 10225 r = x >> y 10226 if r != 0 { 10227 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 10228 } 10229 y = 18446744073709551615 10230 r = x >> y 10231 if r != 0 { 10232 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 10233 } 10234 x = 32766 10235 y = 0 10236 r = x >> y 10237 if r != 32766 { 10238 t.Errorf("32766 %s 0 = %d, want 32766", ">>", r) 10239 } 10240 y = 1 10241 r = x >> y 10242 if r != 16383 { 10243 t.Errorf("32766 %s 1 = %d, want 16383", ">>", r) 10244 } 10245 y = 4294967296 10246 r = x >> y 10247 if r != 0 { 10248 t.Errorf("32766 %s 4294967296 = %d, want 0", ">>", r) 10249 } 10250 y = 18446744073709551615 10251 r = x >> y 10252 if r != 0 { 10253 t.Errorf("32766 %s 18446744073709551615 = %d, want 0", ">>", r) 10254 } 10255 x = 32767 10256 y = 0 10257 r = x >> y 10258 if r != 32767 { 10259 t.Errorf("32767 %s 0 = %d, want 32767", ">>", r) 10260 } 10261 y = 1 10262 r = x >> y 10263 if r != 16383 { 10264 t.Errorf("32767 %s 1 = %d, want 16383", ">>", r) 10265 } 10266 y = 4294967296 10267 r = x >> y 10268 if r != 0 { 10269 t.Errorf("32767 %s 4294967296 = %d, want 0", ">>", r) 10270 } 10271 y = 18446744073709551615 10272 r = x >> y 10273 if r != 0 { 10274 t.Errorf("32767 %s 18446744073709551615 = %d, want 0", ">>", r) 10275 } 10276 } 10277 func TestConstFoldint16uint32lsh(t *testing.T) { 10278 var x, r int16 10279 var y uint32 10280 x = -32768 10281 y = 0 10282 r = x << y 10283 if r != -32768 { 10284 t.Errorf("-32768 %s 0 = %d, want -32768", "<<", r) 10285 } 10286 y = 1 10287 r = x << y 10288 if r != 0 { 10289 t.Errorf("-32768 %s 1 = %d, want 0", "<<", r) 10290 } 10291 y = 4294967295 10292 r = x << y 10293 if r != 0 { 10294 t.Errorf("-32768 %s 4294967295 = %d, want 0", "<<", r) 10295 } 10296 x = -32767 10297 y = 0 10298 r = x << y 10299 if r != -32767 { 10300 t.Errorf("-32767 %s 0 = %d, want -32767", "<<", r) 10301 } 10302 y = 1 10303 r = x << y 10304 if r != 2 { 10305 t.Errorf("-32767 %s 1 = %d, want 2", "<<", r) 10306 } 10307 y = 4294967295 10308 r = x << y 10309 if r != 0 { 10310 t.Errorf("-32767 %s 4294967295 = %d, want 0", "<<", r) 10311 } 10312 x = -1 10313 y = 0 10314 r = x << y 10315 if r != -1 { 10316 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 10317 } 10318 y = 1 10319 r = x << y 10320 if r != -2 { 10321 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 10322 } 10323 y = 4294967295 10324 r = x << y 10325 if r != 0 { 10326 t.Errorf("-1 %s 4294967295 = %d, want 0", "<<", r) 10327 } 10328 x = 0 10329 y = 0 10330 r = x << y 10331 if r != 0 { 10332 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 10333 } 10334 y = 1 10335 r = x << y 10336 if r != 0 { 10337 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 10338 } 10339 y = 4294967295 10340 r = x << y 10341 if r != 0 { 10342 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 10343 } 10344 x = 1 10345 y = 0 10346 r = x << y 10347 if r != 1 { 10348 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 10349 } 10350 y = 1 10351 r = x << y 10352 if r != 2 { 10353 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 10354 } 10355 y = 4294967295 10356 r = x << y 10357 if r != 0 { 10358 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 10359 } 10360 x = 32766 10361 y = 0 10362 r = x << y 10363 if r != 32766 { 10364 t.Errorf("32766 %s 0 = %d, want 32766", "<<", r) 10365 } 10366 y = 1 10367 r = x << y 10368 if r != -4 { 10369 t.Errorf("32766 %s 1 = %d, want -4", "<<", r) 10370 } 10371 y = 4294967295 10372 r = x << y 10373 if r != 0 { 10374 t.Errorf("32766 %s 4294967295 = %d, want 0", "<<", r) 10375 } 10376 x = 32767 10377 y = 0 10378 r = x << y 10379 if r != 32767 { 10380 t.Errorf("32767 %s 0 = %d, want 32767", "<<", r) 10381 } 10382 y = 1 10383 r = x << y 10384 if r != -2 { 10385 t.Errorf("32767 %s 1 = %d, want -2", "<<", r) 10386 } 10387 y = 4294967295 10388 r = x << y 10389 if r != 0 { 10390 t.Errorf("32767 %s 4294967295 = %d, want 0", "<<", r) 10391 } 10392 } 10393 func TestConstFoldint16uint32rsh(t *testing.T) { 10394 var x, r int16 10395 var y uint32 10396 x = -32768 10397 y = 0 10398 r = x >> y 10399 if r != -32768 { 10400 t.Errorf("-32768 %s 0 = %d, want -32768", ">>", r) 10401 } 10402 y = 1 10403 r = x >> y 10404 if r != -16384 { 10405 t.Errorf("-32768 %s 1 = %d, want -16384", ">>", r) 10406 } 10407 y = 4294967295 10408 r = x >> y 10409 if r != -1 { 10410 t.Errorf("-32768 %s 4294967295 = %d, want -1", ">>", r) 10411 } 10412 x = -32767 10413 y = 0 10414 r = x >> y 10415 if r != -32767 { 10416 t.Errorf("-32767 %s 0 = %d, want -32767", ">>", r) 10417 } 10418 y = 1 10419 r = x >> y 10420 if r != -16384 { 10421 t.Errorf("-32767 %s 1 = %d, want -16384", ">>", r) 10422 } 10423 y = 4294967295 10424 r = x >> y 10425 if r != -1 { 10426 t.Errorf("-32767 %s 4294967295 = %d, want -1", ">>", r) 10427 } 10428 x = -1 10429 y = 0 10430 r = x >> y 10431 if r != -1 { 10432 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 10433 } 10434 y = 1 10435 r = x >> y 10436 if r != -1 { 10437 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 10438 } 10439 y = 4294967295 10440 r = x >> y 10441 if r != -1 { 10442 t.Errorf("-1 %s 4294967295 = %d, want -1", ">>", r) 10443 } 10444 x = 0 10445 y = 0 10446 r = x >> y 10447 if r != 0 { 10448 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 10449 } 10450 y = 1 10451 r = x >> y 10452 if r != 0 { 10453 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 10454 } 10455 y = 4294967295 10456 r = x >> y 10457 if r != 0 { 10458 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 10459 } 10460 x = 1 10461 y = 0 10462 r = x >> y 10463 if r != 1 { 10464 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 10465 } 10466 y = 1 10467 r = x >> y 10468 if r != 0 { 10469 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 10470 } 10471 y = 4294967295 10472 r = x >> y 10473 if r != 0 { 10474 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 10475 } 10476 x = 32766 10477 y = 0 10478 r = x >> y 10479 if r != 32766 { 10480 t.Errorf("32766 %s 0 = %d, want 32766", ">>", r) 10481 } 10482 y = 1 10483 r = x >> y 10484 if r != 16383 { 10485 t.Errorf("32766 %s 1 = %d, want 16383", ">>", r) 10486 } 10487 y = 4294967295 10488 r = x >> y 10489 if r != 0 { 10490 t.Errorf("32766 %s 4294967295 = %d, want 0", ">>", r) 10491 } 10492 x = 32767 10493 y = 0 10494 r = x >> y 10495 if r != 32767 { 10496 t.Errorf("32767 %s 0 = %d, want 32767", ">>", r) 10497 } 10498 y = 1 10499 r = x >> y 10500 if r != 16383 { 10501 t.Errorf("32767 %s 1 = %d, want 16383", ">>", r) 10502 } 10503 y = 4294967295 10504 r = x >> y 10505 if r != 0 { 10506 t.Errorf("32767 %s 4294967295 = %d, want 0", ">>", r) 10507 } 10508 } 10509 func TestConstFoldint16uint16lsh(t *testing.T) { 10510 var x, r int16 10511 var y uint16 10512 x = -32768 10513 y = 0 10514 r = x << y 10515 if r != -32768 { 10516 t.Errorf("-32768 %s 0 = %d, want -32768", "<<", r) 10517 } 10518 y = 1 10519 r = x << y 10520 if r != 0 { 10521 t.Errorf("-32768 %s 1 = %d, want 0", "<<", r) 10522 } 10523 y = 65535 10524 r = x << y 10525 if r != 0 { 10526 t.Errorf("-32768 %s 65535 = %d, want 0", "<<", r) 10527 } 10528 x = -32767 10529 y = 0 10530 r = x << y 10531 if r != -32767 { 10532 t.Errorf("-32767 %s 0 = %d, want -32767", "<<", r) 10533 } 10534 y = 1 10535 r = x << y 10536 if r != 2 { 10537 t.Errorf("-32767 %s 1 = %d, want 2", "<<", r) 10538 } 10539 y = 65535 10540 r = x << y 10541 if r != 0 { 10542 t.Errorf("-32767 %s 65535 = %d, want 0", "<<", r) 10543 } 10544 x = -1 10545 y = 0 10546 r = x << y 10547 if r != -1 { 10548 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 10549 } 10550 y = 1 10551 r = x << y 10552 if r != -2 { 10553 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 10554 } 10555 y = 65535 10556 r = x << y 10557 if r != 0 { 10558 t.Errorf("-1 %s 65535 = %d, want 0", "<<", r) 10559 } 10560 x = 0 10561 y = 0 10562 r = x << y 10563 if r != 0 { 10564 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 10565 } 10566 y = 1 10567 r = x << y 10568 if r != 0 { 10569 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 10570 } 10571 y = 65535 10572 r = x << y 10573 if r != 0 { 10574 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 10575 } 10576 x = 1 10577 y = 0 10578 r = x << y 10579 if r != 1 { 10580 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 10581 } 10582 y = 1 10583 r = x << y 10584 if r != 2 { 10585 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 10586 } 10587 y = 65535 10588 r = x << y 10589 if r != 0 { 10590 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 10591 } 10592 x = 32766 10593 y = 0 10594 r = x << y 10595 if r != 32766 { 10596 t.Errorf("32766 %s 0 = %d, want 32766", "<<", r) 10597 } 10598 y = 1 10599 r = x << y 10600 if r != -4 { 10601 t.Errorf("32766 %s 1 = %d, want -4", "<<", r) 10602 } 10603 y = 65535 10604 r = x << y 10605 if r != 0 { 10606 t.Errorf("32766 %s 65535 = %d, want 0", "<<", r) 10607 } 10608 x = 32767 10609 y = 0 10610 r = x << y 10611 if r != 32767 { 10612 t.Errorf("32767 %s 0 = %d, want 32767", "<<", r) 10613 } 10614 y = 1 10615 r = x << y 10616 if r != -2 { 10617 t.Errorf("32767 %s 1 = %d, want -2", "<<", r) 10618 } 10619 y = 65535 10620 r = x << y 10621 if r != 0 { 10622 t.Errorf("32767 %s 65535 = %d, want 0", "<<", r) 10623 } 10624 } 10625 func TestConstFoldint16uint16rsh(t *testing.T) { 10626 var x, r int16 10627 var y uint16 10628 x = -32768 10629 y = 0 10630 r = x >> y 10631 if r != -32768 { 10632 t.Errorf("-32768 %s 0 = %d, want -32768", ">>", r) 10633 } 10634 y = 1 10635 r = x >> y 10636 if r != -16384 { 10637 t.Errorf("-32768 %s 1 = %d, want -16384", ">>", r) 10638 } 10639 y = 65535 10640 r = x >> y 10641 if r != -1 { 10642 t.Errorf("-32768 %s 65535 = %d, want -1", ">>", r) 10643 } 10644 x = -32767 10645 y = 0 10646 r = x >> y 10647 if r != -32767 { 10648 t.Errorf("-32767 %s 0 = %d, want -32767", ">>", r) 10649 } 10650 y = 1 10651 r = x >> y 10652 if r != -16384 { 10653 t.Errorf("-32767 %s 1 = %d, want -16384", ">>", r) 10654 } 10655 y = 65535 10656 r = x >> y 10657 if r != -1 { 10658 t.Errorf("-32767 %s 65535 = %d, want -1", ">>", r) 10659 } 10660 x = -1 10661 y = 0 10662 r = x >> y 10663 if r != -1 { 10664 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 10665 } 10666 y = 1 10667 r = x >> y 10668 if r != -1 { 10669 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 10670 } 10671 y = 65535 10672 r = x >> y 10673 if r != -1 { 10674 t.Errorf("-1 %s 65535 = %d, want -1", ">>", r) 10675 } 10676 x = 0 10677 y = 0 10678 r = x >> y 10679 if r != 0 { 10680 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 10681 } 10682 y = 1 10683 r = x >> y 10684 if r != 0 { 10685 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 10686 } 10687 y = 65535 10688 r = x >> y 10689 if r != 0 { 10690 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 10691 } 10692 x = 1 10693 y = 0 10694 r = x >> y 10695 if r != 1 { 10696 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 10697 } 10698 y = 1 10699 r = x >> y 10700 if r != 0 { 10701 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 10702 } 10703 y = 65535 10704 r = x >> y 10705 if r != 0 { 10706 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 10707 } 10708 x = 32766 10709 y = 0 10710 r = x >> y 10711 if r != 32766 { 10712 t.Errorf("32766 %s 0 = %d, want 32766", ">>", r) 10713 } 10714 y = 1 10715 r = x >> y 10716 if r != 16383 { 10717 t.Errorf("32766 %s 1 = %d, want 16383", ">>", r) 10718 } 10719 y = 65535 10720 r = x >> y 10721 if r != 0 { 10722 t.Errorf("32766 %s 65535 = %d, want 0", ">>", r) 10723 } 10724 x = 32767 10725 y = 0 10726 r = x >> y 10727 if r != 32767 { 10728 t.Errorf("32767 %s 0 = %d, want 32767", ">>", r) 10729 } 10730 y = 1 10731 r = x >> y 10732 if r != 16383 { 10733 t.Errorf("32767 %s 1 = %d, want 16383", ">>", r) 10734 } 10735 y = 65535 10736 r = x >> y 10737 if r != 0 { 10738 t.Errorf("32767 %s 65535 = %d, want 0", ">>", r) 10739 } 10740 } 10741 func TestConstFoldint16uint8lsh(t *testing.T) { 10742 var x, r int16 10743 var y uint8 10744 x = -32768 10745 y = 0 10746 r = x << y 10747 if r != -32768 { 10748 t.Errorf("-32768 %s 0 = %d, want -32768", "<<", r) 10749 } 10750 y = 1 10751 r = x << y 10752 if r != 0 { 10753 t.Errorf("-32768 %s 1 = %d, want 0", "<<", r) 10754 } 10755 y = 255 10756 r = x << y 10757 if r != 0 { 10758 t.Errorf("-32768 %s 255 = %d, want 0", "<<", r) 10759 } 10760 x = -32767 10761 y = 0 10762 r = x << y 10763 if r != -32767 { 10764 t.Errorf("-32767 %s 0 = %d, want -32767", "<<", r) 10765 } 10766 y = 1 10767 r = x << y 10768 if r != 2 { 10769 t.Errorf("-32767 %s 1 = %d, want 2", "<<", r) 10770 } 10771 y = 255 10772 r = x << y 10773 if r != 0 { 10774 t.Errorf("-32767 %s 255 = %d, want 0", "<<", r) 10775 } 10776 x = -1 10777 y = 0 10778 r = x << y 10779 if r != -1 { 10780 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 10781 } 10782 y = 1 10783 r = x << y 10784 if r != -2 { 10785 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 10786 } 10787 y = 255 10788 r = x << y 10789 if r != 0 { 10790 t.Errorf("-1 %s 255 = %d, want 0", "<<", r) 10791 } 10792 x = 0 10793 y = 0 10794 r = x << y 10795 if r != 0 { 10796 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 10797 } 10798 y = 1 10799 r = x << y 10800 if r != 0 { 10801 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 10802 } 10803 y = 255 10804 r = x << y 10805 if r != 0 { 10806 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 10807 } 10808 x = 1 10809 y = 0 10810 r = x << y 10811 if r != 1 { 10812 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 10813 } 10814 y = 1 10815 r = x << y 10816 if r != 2 { 10817 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 10818 } 10819 y = 255 10820 r = x << y 10821 if r != 0 { 10822 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 10823 } 10824 x = 32766 10825 y = 0 10826 r = x << y 10827 if r != 32766 { 10828 t.Errorf("32766 %s 0 = %d, want 32766", "<<", r) 10829 } 10830 y = 1 10831 r = x << y 10832 if r != -4 { 10833 t.Errorf("32766 %s 1 = %d, want -4", "<<", r) 10834 } 10835 y = 255 10836 r = x << y 10837 if r != 0 { 10838 t.Errorf("32766 %s 255 = %d, want 0", "<<", r) 10839 } 10840 x = 32767 10841 y = 0 10842 r = x << y 10843 if r != 32767 { 10844 t.Errorf("32767 %s 0 = %d, want 32767", "<<", r) 10845 } 10846 y = 1 10847 r = x << y 10848 if r != -2 { 10849 t.Errorf("32767 %s 1 = %d, want -2", "<<", r) 10850 } 10851 y = 255 10852 r = x << y 10853 if r != 0 { 10854 t.Errorf("32767 %s 255 = %d, want 0", "<<", r) 10855 } 10856 } 10857 func TestConstFoldint16uint8rsh(t *testing.T) { 10858 var x, r int16 10859 var y uint8 10860 x = -32768 10861 y = 0 10862 r = x >> y 10863 if r != -32768 { 10864 t.Errorf("-32768 %s 0 = %d, want -32768", ">>", r) 10865 } 10866 y = 1 10867 r = x >> y 10868 if r != -16384 { 10869 t.Errorf("-32768 %s 1 = %d, want -16384", ">>", r) 10870 } 10871 y = 255 10872 r = x >> y 10873 if r != -1 { 10874 t.Errorf("-32768 %s 255 = %d, want -1", ">>", r) 10875 } 10876 x = -32767 10877 y = 0 10878 r = x >> y 10879 if r != -32767 { 10880 t.Errorf("-32767 %s 0 = %d, want -32767", ">>", r) 10881 } 10882 y = 1 10883 r = x >> y 10884 if r != -16384 { 10885 t.Errorf("-32767 %s 1 = %d, want -16384", ">>", r) 10886 } 10887 y = 255 10888 r = x >> y 10889 if r != -1 { 10890 t.Errorf("-32767 %s 255 = %d, want -1", ">>", r) 10891 } 10892 x = -1 10893 y = 0 10894 r = x >> y 10895 if r != -1 { 10896 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 10897 } 10898 y = 1 10899 r = x >> y 10900 if r != -1 { 10901 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 10902 } 10903 y = 255 10904 r = x >> y 10905 if r != -1 { 10906 t.Errorf("-1 %s 255 = %d, want -1", ">>", r) 10907 } 10908 x = 0 10909 y = 0 10910 r = x >> y 10911 if r != 0 { 10912 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 10913 } 10914 y = 1 10915 r = x >> y 10916 if r != 0 { 10917 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 10918 } 10919 y = 255 10920 r = x >> y 10921 if r != 0 { 10922 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 10923 } 10924 x = 1 10925 y = 0 10926 r = x >> y 10927 if r != 1 { 10928 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 10929 } 10930 y = 1 10931 r = x >> y 10932 if r != 0 { 10933 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 10934 } 10935 y = 255 10936 r = x >> y 10937 if r != 0 { 10938 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 10939 } 10940 x = 32766 10941 y = 0 10942 r = x >> y 10943 if r != 32766 { 10944 t.Errorf("32766 %s 0 = %d, want 32766", ">>", r) 10945 } 10946 y = 1 10947 r = x >> y 10948 if r != 16383 { 10949 t.Errorf("32766 %s 1 = %d, want 16383", ">>", r) 10950 } 10951 y = 255 10952 r = x >> y 10953 if r != 0 { 10954 t.Errorf("32766 %s 255 = %d, want 0", ">>", r) 10955 } 10956 x = 32767 10957 y = 0 10958 r = x >> y 10959 if r != 32767 { 10960 t.Errorf("32767 %s 0 = %d, want 32767", ">>", r) 10961 } 10962 y = 1 10963 r = x >> y 10964 if r != 16383 { 10965 t.Errorf("32767 %s 1 = %d, want 16383", ">>", r) 10966 } 10967 y = 255 10968 r = x >> y 10969 if r != 0 { 10970 t.Errorf("32767 %s 255 = %d, want 0", ">>", r) 10971 } 10972 } 10973 func TestConstFolduint8uint64lsh(t *testing.T) { 10974 var x, r uint8 10975 var y uint64 10976 x = 0 10977 y = 0 10978 r = x << y 10979 if r != 0 { 10980 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 10981 } 10982 y = 1 10983 r = x << y 10984 if r != 0 { 10985 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 10986 } 10987 y = 4294967296 10988 r = x << y 10989 if r != 0 { 10990 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 10991 } 10992 y = 18446744073709551615 10993 r = x << y 10994 if r != 0 { 10995 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 10996 } 10997 x = 1 10998 y = 0 10999 r = x << y 11000 if r != 1 { 11001 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11002 } 11003 y = 1 11004 r = x << y 11005 if r != 2 { 11006 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11007 } 11008 y = 4294967296 11009 r = x << y 11010 if r != 0 { 11011 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 11012 } 11013 y = 18446744073709551615 11014 r = x << y 11015 if r != 0 { 11016 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 11017 } 11018 x = 255 11019 y = 0 11020 r = x << y 11021 if r != 255 { 11022 t.Errorf("255 %s 0 = %d, want 255", "<<", r) 11023 } 11024 y = 1 11025 r = x << y 11026 if r != 254 { 11027 t.Errorf("255 %s 1 = %d, want 254", "<<", r) 11028 } 11029 y = 4294967296 11030 r = x << y 11031 if r != 0 { 11032 t.Errorf("255 %s 4294967296 = %d, want 0", "<<", r) 11033 } 11034 y = 18446744073709551615 11035 r = x << y 11036 if r != 0 { 11037 t.Errorf("255 %s 18446744073709551615 = %d, want 0", "<<", r) 11038 } 11039 } 11040 func TestConstFolduint8uint64rsh(t *testing.T) { 11041 var x, r uint8 11042 var y uint64 11043 x = 0 11044 y = 0 11045 r = x >> y 11046 if r != 0 { 11047 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11048 } 11049 y = 1 11050 r = x >> y 11051 if r != 0 { 11052 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11053 } 11054 y = 4294967296 11055 r = x >> y 11056 if r != 0 { 11057 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 11058 } 11059 y = 18446744073709551615 11060 r = x >> y 11061 if r != 0 { 11062 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 11063 } 11064 x = 1 11065 y = 0 11066 r = x >> y 11067 if r != 1 { 11068 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11069 } 11070 y = 1 11071 r = x >> y 11072 if r != 0 { 11073 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11074 } 11075 y = 4294967296 11076 r = x >> y 11077 if r != 0 { 11078 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 11079 } 11080 y = 18446744073709551615 11081 r = x >> y 11082 if r != 0 { 11083 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 11084 } 11085 x = 255 11086 y = 0 11087 r = x >> y 11088 if r != 255 { 11089 t.Errorf("255 %s 0 = %d, want 255", ">>", r) 11090 } 11091 y = 1 11092 r = x >> y 11093 if r != 127 { 11094 t.Errorf("255 %s 1 = %d, want 127", ">>", r) 11095 } 11096 y = 4294967296 11097 r = x >> y 11098 if r != 0 { 11099 t.Errorf("255 %s 4294967296 = %d, want 0", ">>", r) 11100 } 11101 y = 18446744073709551615 11102 r = x >> y 11103 if r != 0 { 11104 t.Errorf("255 %s 18446744073709551615 = %d, want 0", ">>", r) 11105 } 11106 } 11107 func TestConstFolduint8uint32lsh(t *testing.T) { 11108 var x, r uint8 11109 var y uint32 11110 x = 0 11111 y = 0 11112 r = x << y 11113 if r != 0 { 11114 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 11115 } 11116 y = 1 11117 r = x << y 11118 if r != 0 { 11119 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 11120 } 11121 y = 4294967295 11122 r = x << y 11123 if r != 0 { 11124 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 11125 } 11126 x = 1 11127 y = 0 11128 r = x << y 11129 if r != 1 { 11130 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11131 } 11132 y = 1 11133 r = x << y 11134 if r != 2 { 11135 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11136 } 11137 y = 4294967295 11138 r = x << y 11139 if r != 0 { 11140 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 11141 } 11142 x = 255 11143 y = 0 11144 r = x << y 11145 if r != 255 { 11146 t.Errorf("255 %s 0 = %d, want 255", "<<", r) 11147 } 11148 y = 1 11149 r = x << y 11150 if r != 254 { 11151 t.Errorf("255 %s 1 = %d, want 254", "<<", r) 11152 } 11153 y = 4294967295 11154 r = x << y 11155 if r != 0 { 11156 t.Errorf("255 %s 4294967295 = %d, want 0", "<<", r) 11157 } 11158 } 11159 func TestConstFolduint8uint32rsh(t *testing.T) { 11160 var x, r uint8 11161 var y uint32 11162 x = 0 11163 y = 0 11164 r = x >> y 11165 if r != 0 { 11166 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11167 } 11168 y = 1 11169 r = x >> y 11170 if r != 0 { 11171 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11172 } 11173 y = 4294967295 11174 r = x >> y 11175 if r != 0 { 11176 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 11177 } 11178 x = 1 11179 y = 0 11180 r = x >> y 11181 if r != 1 { 11182 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11183 } 11184 y = 1 11185 r = x >> y 11186 if r != 0 { 11187 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11188 } 11189 y = 4294967295 11190 r = x >> y 11191 if r != 0 { 11192 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 11193 } 11194 x = 255 11195 y = 0 11196 r = x >> y 11197 if r != 255 { 11198 t.Errorf("255 %s 0 = %d, want 255", ">>", r) 11199 } 11200 y = 1 11201 r = x >> y 11202 if r != 127 { 11203 t.Errorf("255 %s 1 = %d, want 127", ">>", r) 11204 } 11205 y = 4294967295 11206 r = x >> y 11207 if r != 0 { 11208 t.Errorf("255 %s 4294967295 = %d, want 0", ">>", r) 11209 } 11210 } 11211 func TestConstFolduint8uint16lsh(t *testing.T) { 11212 var x, r uint8 11213 var y uint16 11214 x = 0 11215 y = 0 11216 r = x << y 11217 if r != 0 { 11218 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 11219 } 11220 y = 1 11221 r = x << y 11222 if r != 0 { 11223 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 11224 } 11225 y = 65535 11226 r = x << y 11227 if r != 0 { 11228 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 11229 } 11230 x = 1 11231 y = 0 11232 r = x << y 11233 if r != 1 { 11234 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11235 } 11236 y = 1 11237 r = x << y 11238 if r != 2 { 11239 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11240 } 11241 y = 65535 11242 r = x << y 11243 if r != 0 { 11244 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 11245 } 11246 x = 255 11247 y = 0 11248 r = x << y 11249 if r != 255 { 11250 t.Errorf("255 %s 0 = %d, want 255", "<<", r) 11251 } 11252 y = 1 11253 r = x << y 11254 if r != 254 { 11255 t.Errorf("255 %s 1 = %d, want 254", "<<", r) 11256 } 11257 y = 65535 11258 r = x << y 11259 if r != 0 { 11260 t.Errorf("255 %s 65535 = %d, want 0", "<<", r) 11261 } 11262 } 11263 func TestConstFolduint8uint16rsh(t *testing.T) { 11264 var x, r uint8 11265 var y uint16 11266 x = 0 11267 y = 0 11268 r = x >> y 11269 if r != 0 { 11270 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11271 } 11272 y = 1 11273 r = x >> y 11274 if r != 0 { 11275 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11276 } 11277 y = 65535 11278 r = x >> y 11279 if r != 0 { 11280 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 11281 } 11282 x = 1 11283 y = 0 11284 r = x >> y 11285 if r != 1 { 11286 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11287 } 11288 y = 1 11289 r = x >> y 11290 if r != 0 { 11291 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11292 } 11293 y = 65535 11294 r = x >> y 11295 if r != 0 { 11296 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 11297 } 11298 x = 255 11299 y = 0 11300 r = x >> y 11301 if r != 255 { 11302 t.Errorf("255 %s 0 = %d, want 255", ">>", r) 11303 } 11304 y = 1 11305 r = x >> y 11306 if r != 127 { 11307 t.Errorf("255 %s 1 = %d, want 127", ">>", r) 11308 } 11309 y = 65535 11310 r = x >> y 11311 if r != 0 { 11312 t.Errorf("255 %s 65535 = %d, want 0", ">>", r) 11313 } 11314 } 11315 func TestConstFolduint8uint8lsh(t *testing.T) { 11316 var x, r uint8 11317 var y uint8 11318 x = 0 11319 y = 0 11320 r = x << y 11321 if r != 0 { 11322 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 11323 } 11324 y = 1 11325 r = x << y 11326 if r != 0 { 11327 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 11328 } 11329 y = 255 11330 r = x << y 11331 if r != 0 { 11332 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 11333 } 11334 x = 1 11335 y = 0 11336 r = x << y 11337 if r != 1 { 11338 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11339 } 11340 y = 1 11341 r = x << y 11342 if r != 2 { 11343 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11344 } 11345 y = 255 11346 r = x << y 11347 if r != 0 { 11348 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 11349 } 11350 x = 255 11351 y = 0 11352 r = x << y 11353 if r != 255 { 11354 t.Errorf("255 %s 0 = %d, want 255", "<<", r) 11355 } 11356 y = 1 11357 r = x << y 11358 if r != 254 { 11359 t.Errorf("255 %s 1 = %d, want 254", "<<", r) 11360 } 11361 y = 255 11362 r = x << y 11363 if r != 0 { 11364 t.Errorf("255 %s 255 = %d, want 0", "<<", r) 11365 } 11366 } 11367 func TestConstFolduint8uint8rsh(t *testing.T) { 11368 var x, r uint8 11369 var y uint8 11370 x = 0 11371 y = 0 11372 r = x >> y 11373 if r != 0 { 11374 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11375 } 11376 y = 1 11377 r = x >> y 11378 if r != 0 { 11379 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11380 } 11381 y = 255 11382 r = x >> y 11383 if r != 0 { 11384 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 11385 } 11386 x = 1 11387 y = 0 11388 r = x >> y 11389 if r != 1 { 11390 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11391 } 11392 y = 1 11393 r = x >> y 11394 if r != 0 { 11395 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11396 } 11397 y = 255 11398 r = x >> y 11399 if r != 0 { 11400 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 11401 } 11402 x = 255 11403 y = 0 11404 r = x >> y 11405 if r != 255 { 11406 t.Errorf("255 %s 0 = %d, want 255", ">>", r) 11407 } 11408 y = 1 11409 r = x >> y 11410 if r != 127 { 11411 t.Errorf("255 %s 1 = %d, want 127", ">>", r) 11412 } 11413 y = 255 11414 r = x >> y 11415 if r != 0 { 11416 t.Errorf("255 %s 255 = %d, want 0", ">>", r) 11417 } 11418 } 11419 func TestConstFoldint8uint64lsh(t *testing.T) { 11420 var x, r int8 11421 var y uint64 11422 x = -128 11423 y = 0 11424 r = x << y 11425 if r != -128 { 11426 t.Errorf("-128 %s 0 = %d, want -128", "<<", r) 11427 } 11428 y = 1 11429 r = x << y 11430 if r != 0 { 11431 t.Errorf("-128 %s 1 = %d, want 0", "<<", r) 11432 } 11433 y = 4294967296 11434 r = x << y 11435 if r != 0 { 11436 t.Errorf("-128 %s 4294967296 = %d, want 0", "<<", r) 11437 } 11438 y = 18446744073709551615 11439 r = x << y 11440 if r != 0 { 11441 t.Errorf("-128 %s 18446744073709551615 = %d, want 0", "<<", r) 11442 } 11443 x = -127 11444 y = 0 11445 r = x << y 11446 if r != -127 { 11447 t.Errorf("-127 %s 0 = %d, want -127", "<<", r) 11448 } 11449 y = 1 11450 r = x << y 11451 if r != 2 { 11452 t.Errorf("-127 %s 1 = %d, want 2", "<<", r) 11453 } 11454 y = 4294967296 11455 r = x << y 11456 if r != 0 { 11457 t.Errorf("-127 %s 4294967296 = %d, want 0", "<<", r) 11458 } 11459 y = 18446744073709551615 11460 r = x << y 11461 if r != 0 { 11462 t.Errorf("-127 %s 18446744073709551615 = %d, want 0", "<<", r) 11463 } 11464 x = -1 11465 y = 0 11466 r = x << y 11467 if r != -1 { 11468 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 11469 } 11470 y = 1 11471 r = x << y 11472 if r != -2 { 11473 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 11474 } 11475 y = 4294967296 11476 r = x << y 11477 if r != 0 { 11478 t.Errorf("-1 %s 4294967296 = %d, want 0", "<<", r) 11479 } 11480 y = 18446744073709551615 11481 r = x << y 11482 if r != 0 { 11483 t.Errorf("-1 %s 18446744073709551615 = %d, want 0", "<<", r) 11484 } 11485 x = 0 11486 y = 0 11487 r = x << y 11488 if r != 0 { 11489 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 11490 } 11491 y = 1 11492 r = x << y 11493 if r != 0 { 11494 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 11495 } 11496 y = 4294967296 11497 r = x << y 11498 if r != 0 { 11499 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 11500 } 11501 y = 18446744073709551615 11502 r = x << y 11503 if r != 0 { 11504 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 11505 } 11506 x = 1 11507 y = 0 11508 r = x << y 11509 if r != 1 { 11510 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11511 } 11512 y = 1 11513 r = x << y 11514 if r != 2 { 11515 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11516 } 11517 y = 4294967296 11518 r = x << y 11519 if r != 0 { 11520 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 11521 } 11522 y = 18446744073709551615 11523 r = x << y 11524 if r != 0 { 11525 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 11526 } 11527 x = 126 11528 y = 0 11529 r = x << y 11530 if r != 126 { 11531 t.Errorf("126 %s 0 = %d, want 126", "<<", r) 11532 } 11533 y = 1 11534 r = x << y 11535 if r != -4 { 11536 t.Errorf("126 %s 1 = %d, want -4", "<<", r) 11537 } 11538 y = 4294967296 11539 r = x << y 11540 if r != 0 { 11541 t.Errorf("126 %s 4294967296 = %d, want 0", "<<", r) 11542 } 11543 y = 18446744073709551615 11544 r = x << y 11545 if r != 0 { 11546 t.Errorf("126 %s 18446744073709551615 = %d, want 0", "<<", r) 11547 } 11548 x = 127 11549 y = 0 11550 r = x << y 11551 if r != 127 { 11552 t.Errorf("127 %s 0 = %d, want 127", "<<", r) 11553 } 11554 y = 1 11555 r = x << y 11556 if r != -2 { 11557 t.Errorf("127 %s 1 = %d, want -2", "<<", r) 11558 } 11559 y = 4294967296 11560 r = x << y 11561 if r != 0 { 11562 t.Errorf("127 %s 4294967296 = %d, want 0", "<<", r) 11563 } 11564 y = 18446744073709551615 11565 r = x << y 11566 if r != 0 { 11567 t.Errorf("127 %s 18446744073709551615 = %d, want 0", "<<", r) 11568 } 11569 } 11570 func TestConstFoldint8uint64rsh(t *testing.T) { 11571 var x, r int8 11572 var y uint64 11573 x = -128 11574 y = 0 11575 r = x >> y 11576 if r != -128 { 11577 t.Errorf("-128 %s 0 = %d, want -128", ">>", r) 11578 } 11579 y = 1 11580 r = x >> y 11581 if r != -64 { 11582 t.Errorf("-128 %s 1 = %d, want -64", ">>", r) 11583 } 11584 y = 4294967296 11585 r = x >> y 11586 if r != -1 { 11587 t.Errorf("-128 %s 4294967296 = %d, want -1", ">>", r) 11588 } 11589 y = 18446744073709551615 11590 r = x >> y 11591 if r != -1 { 11592 t.Errorf("-128 %s 18446744073709551615 = %d, want -1", ">>", r) 11593 } 11594 x = -127 11595 y = 0 11596 r = x >> y 11597 if r != -127 { 11598 t.Errorf("-127 %s 0 = %d, want -127", ">>", r) 11599 } 11600 y = 1 11601 r = x >> y 11602 if r != -64 { 11603 t.Errorf("-127 %s 1 = %d, want -64", ">>", r) 11604 } 11605 y = 4294967296 11606 r = x >> y 11607 if r != -1 { 11608 t.Errorf("-127 %s 4294967296 = %d, want -1", ">>", r) 11609 } 11610 y = 18446744073709551615 11611 r = x >> y 11612 if r != -1 { 11613 t.Errorf("-127 %s 18446744073709551615 = %d, want -1", ">>", r) 11614 } 11615 x = -1 11616 y = 0 11617 r = x >> y 11618 if r != -1 { 11619 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 11620 } 11621 y = 1 11622 r = x >> y 11623 if r != -1 { 11624 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 11625 } 11626 y = 4294967296 11627 r = x >> y 11628 if r != -1 { 11629 t.Errorf("-1 %s 4294967296 = %d, want -1", ">>", r) 11630 } 11631 y = 18446744073709551615 11632 r = x >> y 11633 if r != -1 { 11634 t.Errorf("-1 %s 18446744073709551615 = %d, want -1", ">>", r) 11635 } 11636 x = 0 11637 y = 0 11638 r = x >> y 11639 if r != 0 { 11640 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11641 } 11642 y = 1 11643 r = x >> y 11644 if r != 0 { 11645 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11646 } 11647 y = 4294967296 11648 r = x >> y 11649 if r != 0 { 11650 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 11651 } 11652 y = 18446744073709551615 11653 r = x >> y 11654 if r != 0 { 11655 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 11656 } 11657 x = 1 11658 y = 0 11659 r = x >> y 11660 if r != 1 { 11661 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11662 } 11663 y = 1 11664 r = x >> y 11665 if r != 0 { 11666 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11667 } 11668 y = 4294967296 11669 r = x >> y 11670 if r != 0 { 11671 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 11672 } 11673 y = 18446744073709551615 11674 r = x >> y 11675 if r != 0 { 11676 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 11677 } 11678 x = 126 11679 y = 0 11680 r = x >> y 11681 if r != 126 { 11682 t.Errorf("126 %s 0 = %d, want 126", ">>", r) 11683 } 11684 y = 1 11685 r = x >> y 11686 if r != 63 { 11687 t.Errorf("126 %s 1 = %d, want 63", ">>", r) 11688 } 11689 y = 4294967296 11690 r = x >> y 11691 if r != 0 { 11692 t.Errorf("126 %s 4294967296 = %d, want 0", ">>", r) 11693 } 11694 y = 18446744073709551615 11695 r = x >> y 11696 if r != 0 { 11697 t.Errorf("126 %s 18446744073709551615 = %d, want 0", ">>", r) 11698 } 11699 x = 127 11700 y = 0 11701 r = x >> y 11702 if r != 127 { 11703 t.Errorf("127 %s 0 = %d, want 127", ">>", r) 11704 } 11705 y = 1 11706 r = x >> y 11707 if r != 63 { 11708 t.Errorf("127 %s 1 = %d, want 63", ">>", r) 11709 } 11710 y = 4294967296 11711 r = x >> y 11712 if r != 0 { 11713 t.Errorf("127 %s 4294967296 = %d, want 0", ">>", r) 11714 } 11715 y = 18446744073709551615 11716 r = x >> y 11717 if r != 0 { 11718 t.Errorf("127 %s 18446744073709551615 = %d, want 0", ">>", r) 11719 } 11720 } 11721 func TestConstFoldint8uint32lsh(t *testing.T) { 11722 var x, r int8 11723 var y uint32 11724 x = -128 11725 y = 0 11726 r = x << y 11727 if r != -128 { 11728 t.Errorf("-128 %s 0 = %d, want -128", "<<", r) 11729 } 11730 y = 1 11731 r = x << y 11732 if r != 0 { 11733 t.Errorf("-128 %s 1 = %d, want 0", "<<", r) 11734 } 11735 y = 4294967295 11736 r = x << y 11737 if r != 0 { 11738 t.Errorf("-128 %s 4294967295 = %d, want 0", "<<", r) 11739 } 11740 x = -127 11741 y = 0 11742 r = x << y 11743 if r != -127 { 11744 t.Errorf("-127 %s 0 = %d, want -127", "<<", r) 11745 } 11746 y = 1 11747 r = x << y 11748 if r != 2 { 11749 t.Errorf("-127 %s 1 = %d, want 2", "<<", r) 11750 } 11751 y = 4294967295 11752 r = x << y 11753 if r != 0 { 11754 t.Errorf("-127 %s 4294967295 = %d, want 0", "<<", r) 11755 } 11756 x = -1 11757 y = 0 11758 r = x << y 11759 if r != -1 { 11760 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 11761 } 11762 y = 1 11763 r = x << y 11764 if r != -2 { 11765 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 11766 } 11767 y = 4294967295 11768 r = x << y 11769 if r != 0 { 11770 t.Errorf("-1 %s 4294967295 = %d, want 0", "<<", r) 11771 } 11772 x = 0 11773 y = 0 11774 r = x << y 11775 if r != 0 { 11776 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 11777 } 11778 y = 1 11779 r = x << y 11780 if r != 0 { 11781 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 11782 } 11783 y = 4294967295 11784 r = x << y 11785 if r != 0 { 11786 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 11787 } 11788 x = 1 11789 y = 0 11790 r = x << y 11791 if r != 1 { 11792 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11793 } 11794 y = 1 11795 r = x << y 11796 if r != 2 { 11797 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11798 } 11799 y = 4294967295 11800 r = x << y 11801 if r != 0 { 11802 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 11803 } 11804 x = 126 11805 y = 0 11806 r = x << y 11807 if r != 126 { 11808 t.Errorf("126 %s 0 = %d, want 126", "<<", r) 11809 } 11810 y = 1 11811 r = x << y 11812 if r != -4 { 11813 t.Errorf("126 %s 1 = %d, want -4", "<<", r) 11814 } 11815 y = 4294967295 11816 r = x << y 11817 if r != 0 { 11818 t.Errorf("126 %s 4294967295 = %d, want 0", "<<", r) 11819 } 11820 x = 127 11821 y = 0 11822 r = x << y 11823 if r != 127 { 11824 t.Errorf("127 %s 0 = %d, want 127", "<<", r) 11825 } 11826 y = 1 11827 r = x << y 11828 if r != -2 { 11829 t.Errorf("127 %s 1 = %d, want -2", "<<", r) 11830 } 11831 y = 4294967295 11832 r = x << y 11833 if r != 0 { 11834 t.Errorf("127 %s 4294967295 = %d, want 0", "<<", r) 11835 } 11836 } 11837 func TestConstFoldint8uint32rsh(t *testing.T) { 11838 var x, r int8 11839 var y uint32 11840 x = -128 11841 y = 0 11842 r = x >> y 11843 if r != -128 { 11844 t.Errorf("-128 %s 0 = %d, want -128", ">>", r) 11845 } 11846 y = 1 11847 r = x >> y 11848 if r != -64 { 11849 t.Errorf("-128 %s 1 = %d, want -64", ">>", r) 11850 } 11851 y = 4294967295 11852 r = x >> y 11853 if r != -1 { 11854 t.Errorf("-128 %s 4294967295 = %d, want -1", ">>", r) 11855 } 11856 x = -127 11857 y = 0 11858 r = x >> y 11859 if r != -127 { 11860 t.Errorf("-127 %s 0 = %d, want -127", ">>", r) 11861 } 11862 y = 1 11863 r = x >> y 11864 if r != -64 { 11865 t.Errorf("-127 %s 1 = %d, want -64", ">>", r) 11866 } 11867 y = 4294967295 11868 r = x >> y 11869 if r != -1 { 11870 t.Errorf("-127 %s 4294967295 = %d, want -1", ">>", r) 11871 } 11872 x = -1 11873 y = 0 11874 r = x >> y 11875 if r != -1 { 11876 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 11877 } 11878 y = 1 11879 r = x >> y 11880 if r != -1 { 11881 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 11882 } 11883 y = 4294967295 11884 r = x >> y 11885 if r != -1 { 11886 t.Errorf("-1 %s 4294967295 = %d, want -1", ">>", r) 11887 } 11888 x = 0 11889 y = 0 11890 r = x >> y 11891 if r != 0 { 11892 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11893 } 11894 y = 1 11895 r = x >> y 11896 if r != 0 { 11897 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11898 } 11899 y = 4294967295 11900 r = x >> y 11901 if r != 0 { 11902 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 11903 } 11904 x = 1 11905 y = 0 11906 r = x >> y 11907 if r != 1 { 11908 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11909 } 11910 y = 1 11911 r = x >> y 11912 if r != 0 { 11913 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11914 } 11915 y = 4294967295 11916 r = x >> y 11917 if r != 0 { 11918 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 11919 } 11920 x = 126 11921 y = 0 11922 r = x >> y 11923 if r != 126 { 11924 t.Errorf("126 %s 0 = %d, want 126", ">>", r) 11925 } 11926 y = 1 11927 r = x >> y 11928 if r != 63 { 11929 t.Errorf("126 %s 1 = %d, want 63", ">>", r) 11930 } 11931 y = 4294967295 11932 r = x >> y 11933 if r != 0 { 11934 t.Errorf("126 %s 4294967295 = %d, want 0", ">>", r) 11935 } 11936 x = 127 11937 y = 0 11938 r = x >> y 11939 if r != 127 { 11940 t.Errorf("127 %s 0 = %d, want 127", ">>", r) 11941 } 11942 y = 1 11943 r = x >> y 11944 if r != 63 { 11945 t.Errorf("127 %s 1 = %d, want 63", ">>", r) 11946 } 11947 y = 4294967295 11948 r = x >> y 11949 if r != 0 { 11950 t.Errorf("127 %s 4294967295 = %d, want 0", ">>", r) 11951 } 11952 } 11953 func TestConstFoldint8uint16lsh(t *testing.T) { 11954 var x, r int8 11955 var y uint16 11956 x = -128 11957 y = 0 11958 r = x << y 11959 if r != -128 { 11960 t.Errorf("-128 %s 0 = %d, want -128", "<<", r) 11961 } 11962 y = 1 11963 r = x << y 11964 if r != 0 { 11965 t.Errorf("-128 %s 1 = %d, want 0", "<<", r) 11966 } 11967 y = 65535 11968 r = x << y 11969 if r != 0 { 11970 t.Errorf("-128 %s 65535 = %d, want 0", "<<", r) 11971 } 11972 x = -127 11973 y = 0 11974 r = x << y 11975 if r != -127 { 11976 t.Errorf("-127 %s 0 = %d, want -127", "<<", r) 11977 } 11978 y = 1 11979 r = x << y 11980 if r != 2 { 11981 t.Errorf("-127 %s 1 = %d, want 2", "<<", r) 11982 } 11983 y = 65535 11984 r = x << y 11985 if r != 0 { 11986 t.Errorf("-127 %s 65535 = %d, want 0", "<<", r) 11987 } 11988 x = -1 11989 y = 0 11990 r = x << y 11991 if r != -1 { 11992 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 11993 } 11994 y = 1 11995 r = x << y 11996 if r != -2 { 11997 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 11998 } 11999 y = 65535 12000 r = x << y 12001 if r != 0 { 12002 t.Errorf("-1 %s 65535 = %d, want 0", "<<", r) 12003 } 12004 x = 0 12005 y = 0 12006 r = x << y 12007 if r != 0 { 12008 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 12009 } 12010 y = 1 12011 r = x << y 12012 if r != 0 { 12013 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 12014 } 12015 y = 65535 12016 r = x << y 12017 if r != 0 { 12018 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 12019 } 12020 x = 1 12021 y = 0 12022 r = x << y 12023 if r != 1 { 12024 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 12025 } 12026 y = 1 12027 r = x << y 12028 if r != 2 { 12029 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 12030 } 12031 y = 65535 12032 r = x << y 12033 if r != 0 { 12034 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 12035 } 12036 x = 126 12037 y = 0 12038 r = x << y 12039 if r != 126 { 12040 t.Errorf("126 %s 0 = %d, want 126", "<<", r) 12041 } 12042 y = 1 12043 r = x << y 12044 if r != -4 { 12045 t.Errorf("126 %s 1 = %d, want -4", "<<", r) 12046 } 12047 y = 65535 12048 r = x << y 12049 if r != 0 { 12050 t.Errorf("126 %s 65535 = %d, want 0", "<<", r) 12051 } 12052 x = 127 12053 y = 0 12054 r = x << y 12055 if r != 127 { 12056 t.Errorf("127 %s 0 = %d, want 127", "<<", r) 12057 } 12058 y = 1 12059 r = x << y 12060 if r != -2 { 12061 t.Errorf("127 %s 1 = %d, want -2", "<<", r) 12062 } 12063 y = 65535 12064 r = x << y 12065 if r != 0 { 12066 t.Errorf("127 %s 65535 = %d, want 0", "<<", r) 12067 } 12068 } 12069 func TestConstFoldint8uint16rsh(t *testing.T) { 12070 var x, r int8 12071 var y uint16 12072 x = -128 12073 y = 0 12074 r = x >> y 12075 if r != -128 { 12076 t.Errorf("-128 %s 0 = %d, want -128", ">>", r) 12077 } 12078 y = 1 12079 r = x >> y 12080 if r != -64 { 12081 t.Errorf("-128 %s 1 = %d, want -64", ">>", r) 12082 } 12083 y = 65535 12084 r = x >> y 12085 if r != -1 { 12086 t.Errorf("-128 %s 65535 = %d, want -1", ">>", r) 12087 } 12088 x = -127 12089 y = 0 12090 r = x >> y 12091 if r != -127 { 12092 t.Errorf("-127 %s 0 = %d, want -127", ">>", r) 12093 } 12094 y = 1 12095 r = x >> y 12096 if r != -64 { 12097 t.Errorf("-127 %s 1 = %d, want -64", ">>", r) 12098 } 12099 y = 65535 12100 r = x >> y 12101 if r != -1 { 12102 t.Errorf("-127 %s 65535 = %d, want -1", ">>", r) 12103 } 12104 x = -1 12105 y = 0 12106 r = x >> y 12107 if r != -1 { 12108 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 12109 } 12110 y = 1 12111 r = x >> y 12112 if r != -1 { 12113 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 12114 } 12115 y = 65535 12116 r = x >> y 12117 if r != -1 { 12118 t.Errorf("-1 %s 65535 = %d, want -1", ">>", r) 12119 } 12120 x = 0 12121 y = 0 12122 r = x >> y 12123 if r != 0 { 12124 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 12125 } 12126 y = 1 12127 r = x >> y 12128 if r != 0 { 12129 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 12130 } 12131 y = 65535 12132 r = x >> y 12133 if r != 0 { 12134 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 12135 } 12136 x = 1 12137 y = 0 12138 r = x >> y 12139 if r != 1 { 12140 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 12141 } 12142 y = 1 12143 r = x >> y 12144 if r != 0 { 12145 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 12146 } 12147 y = 65535 12148 r = x >> y 12149 if r != 0 { 12150 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 12151 } 12152 x = 126 12153 y = 0 12154 r = x >> y 12155 if r != 126 { 12156 t.Errorf("126 %s 0 = %d, want 126", ">>", r) 12157 } 12158 y = 1 12159 r = x >> y 12160 if r != 63 { 12161 t.Errorf("126 %s 1 = %d, want 63", ">>", r) 12162 } 12163 y = 65535 12164 r = x >> y 12165 if r != 0 { 12166 t.Errorf("126 %s 65535 = %d, want 0", ">>", r) 12167 } 12168 x = 127 12169 y = 0 12170 r = x >> y 12171 if r != 127 { 12172 t.Errorf("127 %s 0 = %d, want 127", ">>", r) 12173 } 12174 y = 1 12175 r = x >> y 12176 if r != 63 { 12177 t.Errorf("127 %s 1 = %d, want 63", ">>", r) 12178 } 12179 y = 65535 12180 r = x >> y 12181 if r != 0 { 12182 t.Errorf("127 %s 65535 = %d, want 0", ">>", r) 12183 } 12184 } 12185 func TestConstFoldint8uint8lsh(t *testing.T) { 12186 var x, r int8 12187 var y uint8 12188 x = -128 12189 y = 0 12190 r = x << y 12191 if r != -128 { 12192 t.Errorf("-128 %s 0 = %d, want -128", "<<", r) 12193 } 12194 y = 1 12195 r = x << y 12196 if r != 0 { 12197 t.Errorf("-128 %s 1 = %d, want 0", "<<", r) 12198 } 12199 y = 255 12200 r = x << y 12201 if r != 0 { 12202 t.Errorf("-128 %s 255 = %d, want 0", "<<", r) 12203 } 12204 x = -127 12205 y = 0 12206 r = x << y 12207 if r != -127 { 12208 t.Errorf("-127 %s 0 = %d, want -127", "<<", r) 12209 } 12210 y = 1 12211 r = x << y 12212 if r != 2 { 12213 t.Errorf("-127 %s 1 = %d, want 2", "<<", r) 12214 } 12215 y = 255 12216 r = x << y 12217 if r != 0 { 12218 t.Errorf("-127 %s 255 = %d, want 0", "<<", r) 12219 } 12220 x = -1 12221 y = 0 12222 r = x << y 12223 if r != -1 { 12224 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 12225 } 12226 y = 1 12227 r = x << y 12228 if r != -2 { 12229 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 12230 } 12231 y = 255 12232 r = x << y 12233 if r != 0 { 12234 t.Errorf("-1 %s 255 = %d, want 0", "<<", r) 12235 } 12236 x = 0 12237 y = 0 12238 r = x << y 12239 if r != 0 { 12240 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 12241 } 12242 y = 1 12243 r = x << y 12244 if r != 0 { 12245 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 12246 } 12247 y = 255 12248 r = x << y 12249 if r != 0 { 12250 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 12251 } 12252 x = 1 12253 y = 0 12254 r = x << y 12255 if r != 1 { 12256 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 12257 } 12258 y = 1 12259 r = x << y 12260 if r != 2 { 12261 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 12262 } 12263 y = 255 12264 r = x << y 12265 if r != 0 { 12266 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 12267 } 12268 x = 126 12269 y = 0 12270 r = x << y 12271 if r != 126 { 12272 t.Errorf("126 %s 0 = %d, want 126", "<<", r) 12273 } 12274 y = 1 12275 r = x << y 12276 if r != -4 { 12277 t.Errorf("126 %s 1 = %d, want -4", "<<", r) 12278 } 12279 y = 255 12280 r = x << y 12281 if r != 0 { 12282 t.Errorf("126 %s 255 = %d, want 0", "<<", r) 12283 } 12284 x = 127 12285 y = 0 12286 r = x << y 12287 if r != 127 { 12288 t.Errorf("127 %s 0 = %d, want 127", "<<", r) 12289 } 12290 y = 1 12291 r = x << y 12292 if r != -2 { 12293 t.Errorf("127 %s 1 = %d, want -2", "<<", r) 12294 } 12295 y = 255 12296 r = x << y 12297 if r != 0 { 12298 t.Errorf("127 %s 255 = %d, want 0", "<<", r) 12299 } 12300 } 12301 func TestConstFoldint8uint8rsh(t *testing.T) { 12302 var x, r int8 12303 var y uint8 12304 x = -128 12305 y = 0 12306 r = x >> y 12307 if r != -128 { 12308 t.Errorf("-128 %s 0 = %d, want -128", ">>", r) 12309 } 12310 y = 1 12311 r = x >> y 12312 if r != -64 { 12313 t.Errorf("-128 %s 1 = %d, want -64", ">>", r) 12314 } 12315 y = 255 12316 r = x >> y 12317 if r != -1 { 12318 t.Errorf("-128 %s 255 = %d, want -1", ">>", r) 12319 } 12320 x = -127 12321 y = 0 12322 r = x >> y 12323 if r != -127 { 12324 t.Errorf("-127 %s 0 = %d, want -127", ">>", r) 12325 } 12326 y = 1 12327 r = x >> y 12328 if r != -64 { 12329 t.Errorf("-127 %s 1 = %d, want -64", ">>", r) 12330 } 12331 y = 255 12332 r = x >> y 12333 if r != -1 { 12334 t.Errorf("-127 %s 255 = %d, want -1", ">>", r) 12335 } 12336 x = -1 12337 y = 0 12338 r = x >> y 12339 if r != -1 { 12340 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 12341 } 12342 y = 1 12343 r = x >> y 12344 if r != -1 { 12345 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 12346 } 12347 y = 255 12348 r = x >> y 12349 if r != -1 { 12350 t.Errorf("-1 %s 255 = %d, want -1", ">>", r) 12351 } 12352 x = 0 12353 y = 0 12354 r = x >> y 12355 if r != 0 { 12356 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 12357 } 12358 y = 1 12359 r = x >> y 12360 if r != 0 { 12361 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 12362 } 12363 y = 255 12364 r = x >> y 12365 if r != 0 { 12366 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 12367 } 12368 x = 1 12369 y = 0 12370 r = x >> y 12371 if r != 1 { 12372 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 12373 } 12374 y = 1 12375 r = x >> y 12376 if r != 0 { 12377 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 12378 } 12379 y = 255 12380 r = x >> y 12381 if r != 0 { 12382 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 12383 } 12384 x = 126 12385 y = 0 12386 r = x >> y 12387 if r != 126 { 12388 t.Errorf("126 %s 0 = %d, want 126", ">>", r) 12389 } 12390 y = 1 12391 r = x >> y 12392 if r != 63 { 12393 t.Errorf("126 %s 1 = %d, want 63", ">>", r) 12394 } 12395 y = 255 12396 r = x >> y 12397 if r != 0 { 12398 t.Errorf("126 %s 255 = %d, want 0", ">>", r) 12399 } 12400 x = 127 12401 y = 0 12402 r = x >> y 12403 if r != 127 { 12404 t.Errorf("127 %s 0 = %d, want 127", ">>", r) 12405 } 12406 y = 1 12407 r = x >> y 12408 if r != 63 { 12409 t.Errorf("127 %s 1 = %d, want 63", ">>", r) 12410 } 12411 y = 255 12412 r = x >> y 12413 if r != 0 { 12414 t.Errorf("127 %s 255 = %d, want 0", ">>", r) 12415 } 12416 } 12417 func TestConstFoldCompareuint64(t *testing.T) { 12418 { 12419 var x uint64 = 0 12420 var y uint64 = 0 12421 if !(x == y) { 12422 t.Errorf("!(%d == %d)", x, y) 12423 } 12424 if x != y { 12425 t.Errorf("%d != %d", x, y) 12426 } 12427 if x < y { 12428 t.Errorf("%d < %d", x, y) 12429 } 12430 if x > y { 12431 t.Errorf("%d > %d", x, y) 12432 } 12433 if !(x <= y) { 12434 t.Errorf("!(%d <= %d)", x, y) 12435 } 12436 if !(x >= y) { 12437 t.Errorf("!(%d >= %d)", x, y) 12438 } 12439 } 12440 { 12441 var x uint64 = 0 12442 var y uint64 = 1 12443 if x == y { 12444 t.Errorf("%d == %d", x, y) 12445 } 12446 if !(x != y) { 12447 t.Errorf("!(%d != %d)", x, y) 12448 } 12449 if !(x < y) { 12450 t.Errorf("!(%d < %d)", x, y) 12451 } 12452 if x > y { 12453 t.Errorf("%d > %d", x, y) 12454 } 12455 if !(x <= y) { 12456 t.Errorf("!(%d <= %d)", x, y) 12457 } 12458 if x >= y { 12459 t.Errorf("%d >= %d", x, y) 12460 } 12461 } 12462 { 12463 var x uint64 = 0 12464 var y uint64 = 4294967296 12465 if x == y { 12466 t.Errorf("%d == %d", x, y) 12467 } 12468 if !(x != y) { 12469 t.Errorf("!(%d != %d)", x, y) 12470 } 12471 if !(x < y) { 12472 t.Errorf("!(%d < %d)", x, y) 12473 } 12474 if x > y { 12475 t.Errorf("%d > %d", x, y) 12476 } 12477 if !(x <= y) { 12478 t.Errorf("!(%d <= %d)", x, y) 12479 } 12480 if x >= y { 12481 t.Errorf("%d >= %d", x, y) 12482 } 12483 } 12484 { 12485 var x uint64 = 0 12486 var y uint64 = 18446744073709551615 12487 if x == y { 12488 t.Errorf("%d == %d", x, y) 12489 } 12490 if !(x != y) { 12491 t.Errorf("!(%d != %d)", x, y) 12492 } 12493 if !(x < y) { 12494 t.Errorf("!(%d < %d)", x, y) 12495 } 12496 if x > y { 12497 t.Errorf("%d > %d", x, y) 12498 } 12499 if !(x <= y) { 12500 t.Errorf("!(%d <= %d)", x, y) 12501 } 12502 if x >= y { 12503 t.Errorf("%d >= %d", x, y) 12504 } 12505 } 12506 { 12507 var x uint64 = 1 12508 var y uint64 = 0 12509 if x == y { 12510 t.Errorf("%d == %d", x, y) 12511 } 12512 if !(x != y) { 12513 t.Errorf("!(%d != %d)", x, y) 12514 } 12515 if x < y { 12516 t.Errorf("%d < %d", x, y) 12517 } 12518 if !(x > y) { 12519 t.Errorf("!(%d > %d)", x, y) 12520 } 12521 if x <= y { 12522 t.Errorf("%d <= %d", x, y) 12523 } 12524 if !(x >= y) { 12525 t.Errorf("!(%d >= %d)", x, y) 12526 } 12527 } 12528 { 12529 var x uint64 = 1 12530 var y uint64 = 1 12531 if !(x == y) { 12532 t.Errorf("!(%d == %d)", x, y) 12533 } 12534 if x != y { 12535 t.Errorf("%d != %d", x, y) 12536 } 12537 if x < y { 12538 t.Errorf("%d < %d", x, y) 12539 } 12540 if x > y { 12541 t.Errorf("%d > %d", x, y) 12542 } 12543 if !(x <= y) { 12544 t.Errorf("!(%d <= %d)", x, y) 12545 } 12546 if !(x >= y) { 12547 t.Errorf("!(%d >= %d)", x, y) 12548 } 12549 } 12550 { 12551 var x uint64 = 1 12552 var y uint64 = 4294967296 12553 if x == y { 12554 t.Errorf("%d == %d", x, y) 12555 } 12556 if !(x != y) { 12557 t.Errorf("!(%d != %d)", x, y) 12558 } 12559 if !(x < y) { 12560 t.Errorf("!(%d < %d)", x, y) 12561 } 12562 if x > y { 12563 t.Errorf("%d > %d", x, y) 12564 } 12565 if !(x <= y) { 12566 t.Errorf("!(%d <= %d)", x, y) 12567 } 12568 if x >= y { 12569 t.Errorf("%d >= %d", x, y) 12570 } 12571 } 12572 { 12573 var x uint64 = 1 12574 var y uint64 = 18446744073709551615 12575 if x == y { 12576 t.Errorf("%d == %d", x, y) 12577 } 12578 if !(x != y) { 12579 t.Errorf("!(%d != %d)", x, y) 12580 } 12581 if !(x < y) { 12582 t.Errorf("!(%d < %d)", x, y) 12583 } 12584 if x > y { 12585 t.Errorf("%d > %d", x, y) 12586 } 12587 if !(x <= y) { 12588 t.Errorf("!(%d <= %d)", x, y) 12589 } 12590 if x >= y { 12591 t.Errorf("%d >= %d", x, y) 12592 } 12593 } 12594 { 12595 var x uint64 = 4294967296 12596 var y uint64 = 0 12597 if x == y { 12598 t.Errorf("%d == %d", x, y) 12599 } 12600 if !(x != y) { 12601 t.Errorf("!(%d != %d)", x, y) 12602 } 12603 if x < y { 12604 t.Errorf("%d < %d", x, y) 12605 } 12606 if !(x > y) { 12607 t.Errorf("!(%d > %d)", x, y) 12608 } 12609 if x <= y { 12610 t.Errorf("%d <= %d", x, y) 12611 } 12612 if !(x >= y) { 12613 t.Errorf("!(%d >= %d)", x, y) 12614 } 12615 } 12616 { 12617 var x uint64 = 4294967296 12618 var y uint64 = 1 12619 if x == y { 12620 t.Errorf("%d == %d", x, y) 12621 } 12622 if !(x != y) { 12623 t.Errorf("!(%d != %d)", x, y) 12624 } 12625 if x < y { 12626 t.Errorf("%d < %d", x, y) 12627 } 12628 if !(x > y) { 12629 t.Errorf("!(%d > %d)", x, y) 12630 } 12631 if x <= y { 12632 t.Errorf("%d <= %d", x, y) 12633 } 12634 if !(x >= y) { 12635 t.Errorf("!(%d >= %d)", x, y) 12636 } 12637 } 12638 { 12639 var x uint64 = 4294967296 12640 var y uint64 = 4294967296 12641 if !(x == y) { 12642 t.Errorf("!(%d == %d)", x, y) 12643 } 12644 if x != y { 12645 t.Errorf("%d != %d", x, y) 12646 } 12647 if x < y { 12648 t.Errorf("%d < %d", x, y) 12649 } 12650 if x > y { 12651 t.Errorf("%d > %d", x, y) 12652 } 12653 if !(x <= y) { 12654 t.Errorf("!(%d <= %d)", x, y) 12655 } 12656 if !(x >= y) { 12657 t.Errorf("!(%d >= %d)", x, y) 12658 } 12659 } 12660 { 12661 var x uint64 = 4294967296 12662 var y uint64 = 18446744073709551615 12663 if x == y { 12664 t.Errorf("%d == %d", x, y) 12665 } 12666 if !(x != y) { 12667 t.Errorf("!(%d != %d)", x, y) 12668 } 12669 if !(x < y) { 12670 t.Errorf("!(%d < %d)", x, y) 12671 } 12672 if x > y { 12673 t.Errorf("%d > %d", x, y) 12674 } 12675 if !(x <= y) { 12676 t.Errorf("!(%d <= %d)", x, y) 12677 } 12678 if x >= y { 12679 t.Errorf("%d >= %d", x, y) 12680 } 12681 } 12682 { 12683 var x uint64 = 18446744073709551615 12684 var y uint64 = 0 12685 if x == y { 12686 t.Errorf("%d == %d", x, y) 12687 } 12688 if !(x != y) { 12689 t.Errorf("!(%d != %d)", x, y) 12690 } 12691 if x < y { 12692 t.Errorf("%d < %d", x, y) 12693 } 12694 if !(x > y) { 12695 t.Errorf("!(%d > %d)", x, y) 12696 } 12697 if x <= y { 12698 t.Errorf("%d <= %d", x, y) 12699 } 12700 if !(x >= y) { 12701 t.Errorf("!(%d >= %d)", x, y) 12702 } 12703 } 12704 { 12705 var x uint64 = 18446744073709551615 12706 var y uint64 = 1 12707 if x == y { 12708 t.Errorf("%d == %d", x, y) 12709 } 12710 if !(x != y) { 12711 t.Errorf("!(%d != %d)", x, y) 12712 } 12713 if x < y { 12714 t.Errorf("%d < %d", x, y) 12715 } 12716 if !(x > y) { 12717 t.Errorf("!(%d > %d)", x, y) 12718 } 12719 if x <= y { 12720 t.Errorf("%d <= %d", x, y) 12721 } 12722 if !(x >= y) { 12723 t.Errorf("!(%d >= %d)", x, y) 12724 } 12725 } 12726 { 12727 var x uint64 = 18446744073709551615 12728 var y uint64 = 4294967296 12729 if x == y { 12730 t.Errorf("%d == %d", x, y) 12731 } 12732 if !(x != y) { 12733 t.Errorf("!(%d != %d)", x, y) 12734 } 12735 if x < y { 12736 t.Errorf("%d < %d", x, y) 12737 } 12738 if !(x > y) { 12739 t.Errorf("!(%d > %d)", x, y) 12740 } 12741 if x <= y { 12742 t.Errorf("%d <= %d", x, y) 12743 } 12744 if !(x >= y) { 12745 t.Errorf("!(%d >= %d)", x, y) 12746 } 12747 } 12748 { 12749 var x uint64 = 18446744073709551615 12750 var y uint64 = 18446744073709551615 12751 if !(x == y) { 12752 t.Errorf("!(%d == %d)", x, y) 12753 } 12754 if x != y { 12755 t.Errorf("%d != %d", x, y) 12756 } 12757 if x < y { 12758 t.Errorf("%d < %d", x, y) 12759 } 12760 if x > y { 12761 t.Errorf("%d > %d", x, y) 12762 } 12763 if !(x <= y) { 12764 t.Errorf("!(%d <= %d)", x, y) 12765 } 12766 if !(x >= y) { 12767 t.Errorf("!(%d >= %d)", x, y) 12768 } 12769 } 12770 } 12771 func TestConstFoldCompareint64(t *testing.T) { 12772 { 12773 var x int64 = -9223372036854775808 12774 var y int64 = -9223372036854775808 12775 if !(x == y) { 12776 t.Errorf("!(%d == %d)", x, y) 12777 } 12778 if x != y { 12779 t.Errorf("%d != %d", x, y) 12780 } 12781 if x < y { 12782 t.Errorf("%d < %d", x, y) 12783 } 12784 if x > y { 12785 t.Errorf("%d > %d", x, y) 12786 } 12787 if !(x <= y) { 12788 t.Errorf("!(%d <= %d)", x, y) 12789 } 12790 if !(x >= y) { 12791 t.Errorf("!(%d >= %d)", x, y) 12792 } 12793 } 12794 { 12795 var x int64 = -9223372036854775808 12796 var y int64 = -9223372036854775807 12797 if x == y { 12798 t.Errorf("%d == %d", x, y) 12799 } 12800 if !(x != y) { 12801 t.Errorf("!(%d != %d)", x, y) 12802 } 12803 if !(x < y) { 12804 t.Errorf("!(%d < %d)", x, y) 12805 } 12806 if x > y { 12807 t.Errorf("%d > %d", x, y) 12808 } 12809 if !(x <= y) { 12810 t.Errorf("!(%d <= %d)", x, y) 12811 } 12812 if x >= y { 12813 t.Errorf("%d >= %d", x, y) 12814 } 12815 } 12816 { 12817 var x int64 = -9223372036854775808 12818 var y int64 = -4294967296 12819 if x == y { 12820 t.Errorf("%d == %d", x, y) 12821 } 12822 if !(x != y) { 12823 t.Errorf("!(%d != %d)", x, y) 12824 } 12825 if !(x < y) { 12826 t.Errorf("!(%d < %d)", x, y) 12827 } 12828 if x > y { 12829 t.Errorf("%d > %d", x, y) 12830 } 12831 if !(x <= y) { 12832 t.Errorf("!(%d <= %d)", x, y) 12833 } 12834 if x >= y { 12835 t.Errorf("%d >= %d", x, y) 12836 } 12837 } 12838 { 12839 var x int64 = -9223372036854775808 12840 var y int64 = -1 12841 if x == y { 12842 t.Errorf("%d == %d", x, y) 12843 } 12844 if !(x != y) { 12845 t.Errorf("!(%d != %d)", x, y) 12846 } 12847 if !(x < y) { 12848 t.Errorf("!(%d < %d)", x, y) 12849 } 12850 if x > y { 12851 t.Errorf("%d > %d", x, y) 12852 } 12853 if !(x <= y) { 12854 t.Errorf("!(%d <= %d)", x, y) 12855 } 12856 if x >= y { 12857 t.Errorf("%d >= %d", x, y) 12858 } 12859 } 12860 { 12861 var x int64 = -9223372036854775808 12862 var y int64 = 0 12863 if x == y { 12864 t.Errorf("%d == %d", x, y) 12865 } 12866 if !(x != y) { 12867 t.Errorf("!(%d != %d)", x, y) 12868 } 12869 if !(x < y) { 12870 t.Errorf("!(%d < %d)", x, y) 12871 } 12872 if x > y { 12873 t.Errorf("%d > %d", x, y) 12874 } 12875 if !(x <= y) { 12876 t.Errorf("!(%d <= %d)", x, y) 12877 } 12878 if x >= y { 12879 t.Errorf("%d >= %d", x, y) 12880 } 12881 } 12882 { 12883 var x int64 = -9223372036854775808 12884 var y int64 = 1 12885 if x == y { 12886 t.Errorf("%d == %d", x, y) 12887 } 12888 if !(x != y) { 12889 t.Errorf("!(%d != %d)", x, y) 12890 } 12891 if !(x < y) { 12892 t.Errorf("!(%d < %d)", x, y) 12893 } 12894 if x > y { 12895 t.Errorf("%d > %d", x, y) 12896 } 12897 if !(x <= y) { 12898 t.Errorf("!(%d <= %d)", x, y) 12899 } 12900 if x >= y { 12901 t.Errorf("%d >= %d", x, y) 12902 } 12903 } 12904 { 12905 var x int64 = -9223372036854775808 12906 var y int64 = 4294967296 12907 if x == y { 12908 t.Errorf("%d == %d", x, y) 12909 } 12910 if !(x != y) { 12911 t.Errorf("!(%d != %d)", x, y) 12912 } 12913 if !(x < y) { 12914 t.Errorf("!(%d < %d)", x, y) 12915 } 12916 if x > y { 12917 t.Errorf("%d > %d", x, y) 12918 } 12919 if !(x <= y) { 12920 t.Errorf("!(%d <= %d)", x, y) 12921 } 12922 if x >= y { 12923 t.Errorf("%d >= %d", x, y) 12924 } 12925 } 12926 { 12927 var x int64 = -9223372036854775808 12928 var y int64 = 9223372036854775806 12929 if x == y { 12930 t.Errorf("%d == %d", x, y) 12931 } 12932 if !(x != y) { 12933 t.Errorf("!(%d != %d)", x, y) 12934 } 12935 if !(x < y) { 12936 t.Errorf("!(%d < %d)", x, y) 12937 } 12938 if x > y { 12939 t.Errorf("%d > %d", x, y) 12940 } 12941 if !(x <= y) { 12942 t.Errorf("!(%d <= %d)", x, y) 12943 } 12944 if x >= y { 12945 t.Errorf("%d >= %d", x, y) 12946 } 12947 } 12948 { 12949 var x int64 = -9223372036854775808 12950 var y int64 = 9223372036854775807 12951 if x == y { 12952 t.Errorf("%d == %d", x, y) 12953 } 12954 if !(x != y) { 12955 t.Errorf("!(%d != %d)", x, y) 12956 } 12957 if !(x < y) { 12958 t.Errorf("!(%d < %d)", x, y) 12959 } 12960 if x > y { 12961 t.Errorf("%d > %d", x, y) 12962 } 12963 if !(x <= y) { 12964 t.Errorf("!(%d <= %d)", x, y) 12965 } 12966 if x >= y { 12967 t.Errorf("%d >= %d", x, y) 12968 } 12969 } 12970 { 12971 var x int64 = -9223372036854775807 12972 var y int64 = -9223372036854775808 12973 if x == y { 12974 t.Errorf("%d == %d", x, y) 12975 } 12976 if !(x != y) { 12977 t.Errorf("!(%d != %d)", x, y) 12978 } 12979 if x < y { 12980 t.Errorf("%d < %d", x, y) 12981 } 12982 if !(x > y) { 12983 t.Errorf("!(%d > %d)", x, y) 12984 } 12985 if x <= y { 12986 t.Errorf("%d <= %d", x, y) 12987 } 12988 if !(x >= y) { 12989 t.Errorf("!(%d >= %d)", x, y) 12990 } 12991 } 12992 { 12993 var x int64 = -9223372036854775807 12994 var y int64 = -9223372036854775807 12995 if !(x == y) { 12996 t.Errorf("!(%d == %d)", x, y) 12997 } 12998 if x != y { 12999 t.Errorf("%d != %d", x, y) 13000 } 13001 if x < y { 13002 t.Errorf("%d < %d", x, y) 13003 } 13004 if x > y { 13005 t.Errorf("%d > %d", x, y) 13006 } 13007 if !(x <= y) { 13008 t.Errorf("!(%d <= %d)", x, y) 13009 } 13010 if !(x >= y) { 13011 t.Errorf("!(%d >= %d)", x, y) 13012 } 13013 } 13014 { 13015 var x int64 = -9223372036854775807 13016 var y int64 = -4294967296 13017 if x == y { 13018 t.Errorf("%d == %d", x, y) 13019 } 13020 if !(x != y) { 13021 t.Errorf("!(%d != %d)", x, y) 13022 } 13023 if !(x < y) { 13024 t.Errorf("!(%d < %d)", x, y) 13025 } 13026 if x > y { 13027 t.Errorf("%d > %d", x, y) 13028 } 13029 if !(x <= y) { 13030 t.Errorf("!(%d <= %d)", x, y) 13031 } 13032 if x >= y { 13033 t.Errorf("%d >= %d", x, y) 13034 } 13035 } 13036 { 13037 var x int64 = -9223372036854775807 13038 var y int64 = -1 13039 if x == y { 13040 t.Errorf("%d == %d", x, y) 13041 } 13042 if !(x != y) { 13043 t.Errorf("!(%d != %d)", x, y) 13044 } 13045 if !(x < y) { 13046 t.Errorf("!(%d < %d)", x, y) 13047 } 13048 if x > y { 13049 t.Errorf("%d > %d", x, y) 13050 } 13051 if !(x <= y) { 13052 t.Errorf("!(%d <= %d)", x, y) 13053 } 13054 if x >= y { 13055 t.Errorf("%d >= %d", x, y) 13056 } 13057 } 13058 { 13059 var x int64 = -9223372036854775807 13060 var y int64 = 0 13061 if x == y { 13062 t.Errorf("%d == %d", x, y) 13063 } 13064 if !(x != y) { 13065 t.Errorf("!(%d != %d)", x, y) 13066 } 13067 if !(x < y) { 13068 t.Errorf("!(%d < %d)", x, y) 13069 } 13070 if x > y { 13071 t.Errorf("%d > %d", x, y) 13072 } 13073 if !(x <= y) { 13074 t.Errorf("!(%d <= %d)", x, y) 13075 } 13076 if x >= y { 13077 t.Errorf("%d >= %d", x, y) 13078 } 13079 } 13080 { 13081 var x int64 = -9223372036854775807 13082 var y int64 = 1 13083 if x == y { 13084 t.Errorf("%d == %d", x, y) 13085 } 13086 if !(x != y) { 13087 t.Errorf("!(%d != %d)", x, y) 13088 } 13089 if !(x < y) { 13090 t.Errorf("!(%d < %d)", x, y) 13091 } 13092 if x > y { 13093 t.Errorf("%d > %d", x, y) 13094 } 13095 if !(x <= y) { 13096 t.Errorf("!(%d <= %d)", x, y) 13097 } 13098 if x >= y { 13099 t.Errorf("%d >= %d", x, y) 13100 } 13101 } 13102 { 13103 var x int64 = -9223372036854775807 13104 var y int64 = 4294967296 13105 if x == y { 13106 t.Errorf("%d == %d", x, y) 13107 } 13108 if !(x != y) { 13109 t.Errorf("!(%d != %d)", x, y) 13110 } 13111 if !(x < y) { 13112 t.Errorf("!(%d < %d)", x, y) 13113 } 13114 if x > y { 13115 t.Errorf("%d > %d", x, y) 13116 } 13117 if !(x <= y) { 13118 t.Errorf("!(%d <= %d)", x, y) 13119 } 13120 if x >= y { 13121 t.Errorf("%d >= %d", x, y) 13122 } 13123 } 13124 { 13125 var x int64 = -9223372036854775807 13126 var y int64 = 9223372036854775806 13127 if x == y { 13128 t.Errorf("%d == %d", x, y) 13129 } 13130 if !(x != y) { 13131 t.Errorf("!(%d != %d)", x, y) 13132 } 13133 if !(x < y) { 13134 t.Errorf("!(%d < %d)", x, y) 13135 } 13136 if x > y { 13137 t.Errorf("%d > %d", x, y) 13138 } 13139 if !(x <= y) { 13140 t.Errorf("!(%d <= %d)", x, y) 13141 } 13142 if x >= y { 13143 t.Errorf("%d >= %d", x, y) 13144 } 13145 } 13146 { 13147 var x int64 = -9223372036854775807 13148 var y int64 = 9223372036854775807 13149 if x == y { 13150 t.Errorf("%d == %d", x, y) 13151 } 13152 if !(x != y) { 13153 t.Errorf("!(%d != %d)", x, y) 13154 } 13155 if !(x < y) { 13156 t.Errorf("!(%d < %d)", x, y) 13157 } 13158 if x > y { 13159 t.Errorf("%d > %d", x, y) 13160 } 13161 if !(x <= y) { 13162 t.Errorf("!(%d <= %d)", x, y) 13163 } 13164 if x >= y { 13165 t.Errorf("%d >= %d", x, y) 13166 } 13167 } 13168 { 13169 var x int64 = -4294967296 13170 var y int64 = -9223372036854775808 13171 if x == y { 13172 t.Errorf("%d == %d", x, y) 13173 } 13174 if !(x != y) { 13175 t.Errorf("!(%d != %d)", x, y) 13176 } 13177 if x < y { 13178 t.Errorf("%d < %d", x, y) 13179 } 13180 if !(x > y) { 13181 t.Errorf("!(%d > %d)", x, y) 13182 } 13183 if x <= y { 13184 t.Errorf("%d <= %d", x, y) 13185 } 13186 if !(x >= y) { 13187 t.Errorf("!(%d >= %d)", x, y) 13188 } 13189 } 13190 { 13191 var x int64 = -4294967296 13192 var y int64 = -9223372036854775807 13193 if x == y { 13194 t.Errorf("%d == %d", x, y) 13195 } 13196 if !(x != y) { 13197 t.Errorf("!(%d != %d)", x, y) 13198 } 13199 if x < y { 13200 t.Errorf("%d < %d", x, y) 13201 } 13202 if !(x > y) { 13203 t.Errorf("!(%d > %d)", x, y) 13204 } 13205 if x <= y { 13206 t.Errorf("%d <= %d", x, y) 13207 } 13208 if !(x >= y) { 13209 t.Errorf("!(%d >= %d)", x, y) 13210 } 13211 } 13212 { 13213 var x int64 = -4294967296 13214 var y int64 = -4294967296 13215 if !(x == y) { 13216 t.Errorf("!(%d == %d)", x, y) 13217 } 13218 if x != y { 13219 t.Errorf("%d != %d", x, y) 13220 } 13221 if x < y { 13222 t.Errorf("%d < %d", x, y) 13223 } 13224 if x > y { 13225 t.Errorf("%d > %d", x, y) 13226 } 13227 if !(x <= y) { 13228 t.Errorf("!(%d <= %d)", x, y) 13229 } 13230 if !(x >= y) { 13231 t.Errorf("!(%d >= %d)", x, y) 13232 } 13233 } 13234 { 13235 var x int64 = -4294967296 13236 var y int64 = -1 13237 if x == y { 13238 t.Errorf("%d == %d", x, y) 13239 } 13240 if !(x != y) { 13241 t.Errorf("!(%d != %d)", x, y) 13242 } 13243 if !(x < y) { 13244 t.Errorf("!(%d < %d)", x, y) 13245 } 13246 if x > y { 13247 t.Errorf("%d > %d", x, y) 13248 } 13249 if !(x <= y) { 13250 t.Errorf("!(%d <= %d)", x, y) 13251 } 13252 if x >= y { 13253 t.Errorf("%d >= %d", x, y) 13254 } 13255 } 13256 { 13257 var x int64 = -4294967296 13258 var y int64 = 0 13259 if x == y { 13260 t.Errorf("%d == %d", x, y) 13261 } 13262 if !(x != y) { 13263 t.Errorf("!(%d != %d)", x, y) 13264 } 13265 if !(x < y) { 13266 t.Errorf("!(%d < %d)", x, y) 13267 } 13268 if x > y { 13269 t.Errorf("%d > %d", x, y) 13270 } 13271 if !(x <= y) { 13272 t.Errorf("!(%d <= %d)", x, y) 13273 } 13274 if x >= y { 13275 t.Errorf("%d >= %d", x, y) 13276 } 13277 } 13278 { 13279 var x int64 = -4294967296 13280 var y int64 = 1 13281 if x == y { 13282 t.Errorf("%d == %d", x, y) 13283 } 13284 if !(x != y) { 13285 t.Errorf("!(%d != %d)", x, y) 13286 } 13287 if !(x < y) { 13288 t.Errorf("!(%d < %d)", x, y) 13289 } 13290 if x > y { 13291 t.Errorf("%d > %d", x, y) 13292 } 13293 if !(x <= y) { 13294 t.Errorf("!(%d <= %d)", x, y) 13295 } 13296 if x >= y { 13297 t.Errorf("%d >= %d", x, y) 13298 } 13299 } 13300 { 13301 var x int64 = -4294967296 13302 var y int64 = 4294967296 13303 if x == y { 13304 t.Errorf("%d == %d", x, y) 13305 } 13306 if !(x != y) { 13307 t.Errorf("!(%d != %d)", x, y) 13308 } 13309 if !(x < y) { 13310 t.Errorf("!(%d < %d)", x, y) 13311 } 13312 if x > y { 13313 t.Errorf("%d > %d", x, y) 13314 } 13315 if !(x <= y) { 13316 t.Errorf("!(%d <= %d)", x, y) 13317 } 13318 if x >= y { 13319 t.Errorf("%d >= %d", x, y) 13320 } 13321 } 13322 { 13323 var x int64 = -4294967296 13324 var y int64 = 9223372036854775806 13325 if x == y { 13326 t.Errorf("%d == %d", x, y) 13327 } 13328 if !(x != y) { 13329 t.Errorf("!(%d != %d)", x, y) 13330 } 13331 if !(x < y) { 13332 t.Errorf("!(%d < %d)", x, y) 13333 } 13334 if x > y { 13335 t.Errorf("%d > %d", x, y) 13336 } 13337 if !(x <= y) { 13338 t.Errorf("!(%d <= %d)", x, y) 13339 } 13340 if x >= y { 13341 t.Errorf("%d >= %d", x, y) 13342 } 13343 } 13344 { 13345 var x int64 = -4294967296 13346 var y int64 = 9223372036854775807 13347 if x == y { 13348 t.Errorf("%d == %d", x, y) 13349 } 13350 if !(x != y) { 13351 t.Errorf("!(%d != %d)", x, y) 13352 } 13353 if !(x < y) { 13354 t.Errorf("!(%d < %d)", x, y) 13355 } 13356 if x > y { 13357 t.Errorf("%d > %d", x, y) 13358 } 13359 if !(x <= y) { 13360 t.Errorf("!(%d <= %d)", x, y) 13361 } 13362 if x >= y { 13363 t.Errorf("%d >= %d", x, y) 13364 } 13365 } 13366 { 13367 var x int64 = -1 13368 var y int64 = -9223372036854775808 13369 if x == y { 13370 t.Errorf("%d == %d", x, y) 13371 } 13372 if !(x != y) { 13373 t.Errorf("!(%d != %d)", x, y) 13374 } 13375 if x < y { 13376 t.Errorf("%d < %d", x, y) 13377 } 13378 if !(x > y) { 13379 t.Errorf("!(%d > %d)", x, y) 13380 } 13381 if x <= y { 13382 t.Errorf("%d <= %d", x, y) 13383 } 13384 if !(x >= y) { 13385 t.Errorf("!(%d >= %d)", x, y) 13386 } 13387 } 13388 { 13389 var x int64 = -1 13390 var y int64 = -9223372036854775807 13391 if x == y { 13392 t.Errorf("%d == %d", x, y) 13393 } 13394 if !(x != y) { 13395 t.Errorf("!(%d != %d)", x, y) 13396 } 13397 if x < y { 13398 t.Errorf("%d < %d", x, y) 13399 } 13400 if !(x > y) { 13401 t.Errorf("!(%d > %d)", x, y) 13402 } 13403 if x <= y { 13404 t.Errorf("%d <= %d", x, y) 13405 } 13406 if !(x >= y) { 13407 t.Errorf("!(%d >= %d)", x, y) 13408 } 13409 } 13410 { 13411 var x int64 = -1 13412 var y int64 = -4294967296 13413 if x == y { 13414 t.Errorf("%d == %d", x, y) 13415 } 13416 if !(x != y) { 13417 t.Errorf("!(%d != %d)", x, y) 13418 } 13419 if x < y { 13420 t.Errorf("%d < %d", x, y) 13421 } 13422 if !(x > y) { 13423 t.Errorf("!(%d > %d)", x, y) 13424 } 13425 if x <= y { 13426 t.Errorf("%d <= %d", x, y) 13427 } 13428 if !(x >= y) { 13429 t.Errorf("!(%d >= %d)", x, y) 13430 } 13431 } 13432 { 13433 var x int64 = -1 13434 var y int64 = -1 13435 if !(x == y) { 13436 t.Errorf("!(%d == %d)", x, y) 13437 } 13438 if x != y { 13439 t.Errorf("%d != %d", x, y) 13440 } 13441 if x < y { 13442 t.Errorf("%d < %d", x, y) 13443 } 13444 if x > y { 13445 t.Errorf("%d > %d", x, y) 13446 } 13447 if !(x <= y) { 13448 t.Errorf("!(%d <= %d)", x, y) 13449 } 13450 if !(x >= y) { 13451 t.Errorf("!(%d >= %d)", x, y) 13452 } 13453 } 13454 { 13455 var x int64 = -1 13456 var y int64 = 0 13457 if x == y { 13458 t.Errorf("%d == %d", x, y) 13459 } 13460 if !(x != y) { 13461 t.Errorf("!(%d != %d)", x, y) 13462 } 13463 if !(x < y) { 13464 t.Errorf("!(%d < %d)", x, y) 13465 } 13466 if x > y { 13467 t.Errorf("%d > %d", x, y) 13468 } 13469 if !(x <= y) { 13470 t.Errorf("!(%d <= %d)", x, y) 13471 } 13472 if x >= y { 13473 t.Errorf("%d >= %d", x, y) 13474 } 13475 } 13476 { 13477 var x int64 = -1 13478 var y int64 = 1 13479 if x == y { 13480 t.Errorf("%d == %d", x, y) 13481 } 13482 if !(x != y) { 13483 t.Errorf("!(%d != %d)", x, y) 13484 } 13485 if !(x < y) { 13486 t.Errorf("!(%d < %d)", x, y) 13487 } 13488 if x > y { 13489 t.Errorf("%d > %d", x, y) 13490 } 13491 if !(x <= y) { 13492 t.Errorf("!(%d <= %d)", x, y) 13493 } 13494 if x >= y { 13495 t.Errorf("%d >= %d", x, y) 13496 } 13497 } 13498 { 13499 var x int64 = -1 13500 var y int64 = 4294967296 13501 if x == y { 13502 t.Errorf("%d == %d", x, y) 13503 } 13504 if !(x != y) { 13505 t.Errorf("!(%d != %d)", x, y) 13506 } 13507 if !(x < y) { 13508 t.Errorf("!(%d < %d)", x, y) 13509 } 13510 if x > y { 13511 t.Errorf("%d > %d", x, y) 13512 } 13513 if !(x <= y) { 13514 t.Errorf("!(%d <= %d)", x, y) 13515 } 13516 if x >= y { 13517 t.Errorf("%d >= %d", x, y) 13518 } 13519 } 13520 { 13521 var x int64 = -1 13522 var y int64 = 9223372036854775806 13523 if x == y { 13524 t.Errorf("%d == %d", x, y) 13525 } 13526 if !(x != y) { 13527 t.Errorf("!(%d != %d)", x, y) 13528 } 13529 if !(x < y) { 13530 t.Errorf("!(%d < %d)", x, y) 13531 } 13532 if x > y { 13533 t.Errorf("%d > %d", x, y) 13534 } 13535 if !(x <= y) { 13536 t.Errorf("!(%d <= %d)", x, y) 13537 } 13538 if x >= y { 13539 t.Errorf("%d >= %d", x, y) 13540 } 13541 } 13542 { 13543 var x int64 = -1 13544 var y int64 = 9223372036854775807 13545 if x == y { 13546 t.Errorf("%d == %d", x, y) 13547 } 13548 if !(x != y) { 13549 t.Errorf("!(%d != %d)", x, y) 13550 } 13551 if !(x < y) { 13552 t.Errorf("!(%d < %d)", x, y) 13553 } 13554 if x > y { 13555 t.Errorf("%d > %d", x, y) 13556 } 13557 if !(x <= y) { 13558 t.Errorf("!(%d <= %d)", x, y) 13559 } 13560 if x >= y { 13561 t.Errorf("%d >= %d", x, y) 13562 } 13563 } 13564 { 13565 var x int64 = 0 13566 var y int64 = -9223372036854775808 13567 if x == y { 13568 t.Errorf("%d == %d", x, y) 13569 } 13570 if !(x != y) { 13571 t.Errorf("!(%d != %d)", x, y) 13572 } 13573 if x < y { 13574 t.Errorf("%d < %d", x, y) 13575 } 13576 if !(x > y) { 13577 t.Errorf("!(%d > %d)", x, y) 13578 } 13579 if x <= y { 13580 t.Errorf("%d <= %d", x, y) 13581 } 13582 if !(x >= y) { 13583 t.Errorf("!(%d >= %d)", x, y) 13584 } 13585 } 13586 { 13587 var x int64 = 0 13588 var y int64 = -9223372036854775807 13589 if x == y { 13590 t.Errorf("%d == %d", x, y) 13591 } 13592 if !(x != y) { 13593 t.Errorf("!(%d != %d)", x, y) 13594 } 13595 if x < y { 13596 t.Errorf("%d < %d", x, y) 13597 } 13598 if !(x > y) { 13599 t.Errorf("!(%d > %d)", x, y) 13600 } 13601 if x <= y { 13602 t.Errorf("%d <= %d", x, y) 13603 } 13604 if !(x >= y) { 13605 t.Errorf("!(%d >= %d)", x, y) 13606 } 13607 } 13608 { 13609 var x int64 = 0 13610 var y int64 = -4294967296 13611 if x == y { 13612 t.Errorf("%d == %d", x, y) 13613 } 13614 if !(x != y) { 13615 t.Errorf("!(%d != %d)", x, y) 13616 } 13617 if x < y { 13618 t.Errorf("%d < %d", x, y) 13619 } 13620 if !(x > y) { 13621 t.Errorf("!(%d > %d)", x, y) 13622 } 13623 if x <= y { 13624 t.Errorf("%d <= %d", x, y) 13625 } 13626 if !(x >= y) { 13627 t.Errorf("!(%d >= %d)", x, y) 13628 } 13629 } 13630 { 13631 var x int64 = 0 13632 var y int64 = -1 13633 if x == y { 13634 t.Errorf("%d == %d", x, y) 13635 } 13636 if !(x != y) { 13637 t.Errorf("!(%d != %d)", x, y) 13638 } 13639 if x < y { 13640 t.Errorf("%d < %d", x, y) 13641 } 13642 if !(x > y) { 13643 t.Errorf("!(%d > %d)", x, y) 13644 } 13645 if x <= y { 13646 t.Errorf("%d <= %d", x, y) 13647 } 13648 if !(x >= y) { 13649 t.Errorf("!(%d >= %d)", x, y) 13650 } 13651 } 13652 { 13653 var x int64 = 0 13654 var y int64 = 0 13655 if !(x == y) { 13656 t.Errorf("!(%d == %d)", x, y) 13657 } 13658 if x != y { 13659 t.Errorf("%d != %d", x, y) 13660 } 13661 if x < y { 13662 t.Errorf("%d < %d", x, y) 13663 } 13664 if x > y { 13665 t.Errorf("%d > %d", x, y) 13666 } 13667 if !(x <= y) { 13668 t.Errorf("!(%d <= %d)", x, y) 13669 } 13670 if !(x >= y) { 13671 t.Errorf("!(%d >= %d)", x, y) 13672 } 13673 } 13674 { 13675 var x int64 = 0 13676 var y int64 = 1 13677 if x == y { 13678 t.Errorf("%d == %d", x, y) 13679 } 13680 if !(x != y) { 13681 t.Errorf("!(%d != %d)", x, y) 13682 } 13683 if !(x < y) { 13684 t.Errorf("!(%d < %d)", x, y) 13685 } 13686 if x > y { 13687 t.Errorf("%d > %d", x, y) 13688 } 13689 if !(x <= y) { 13690 t.Errorf("!(%d <= %d)", x, y) 13691 } 13692 if x >= y { 13693 t.Errorf("%d >= %d", x, y) 13694 } 13695 } 13696 { 13697 var x int64 = 0 13698 var y int64 = 4294967296 13699 if x == y { 13700 t.Errorf("%d == %d", x, y) 13701 } 13702 if !(x != y) { 13703 t.Errorf("!(%d != %d)", x, y) 13704 } 13705 if !(x < y) { 13706 t.Errorf("!(%d < %d)", x, y) 13707 } 13708 if x > y { 13709 t.Errorf("%d > %d", x, y) 13710 } 13711 if !(x <= y) { 13712 t.Errorf("!(%d <= %d)", x, y) 13713 } 13714 if x >= y { 13715 t.Errorf("%d >= %d", x, y) 13716 } 13717 } 13718 { 13719 var x int64 = 0 13720 var y int64 = 9223372036854775806 13721 if x == y { 13722 t.Errorf("%d == %d", x, y) 13723 } 13724 if !(x != y) { 13725 t.Errorf("!(%d != %d)", x, y) 13726 } 13727 if !(x < y) { 13728 t.Errorf("!(%d < %d)", x, y) 13729 } 13730 if x > y { 13731 t.Errorf("%d > %d", x, y) 13732 } 13733 if !(x <= y) { 13734 t.Errorf("!(%d <= %d)", x, y) 13735 } 13736 if x >= y { 13737 t.Errorf("%d >= %d", x, y) 13738 } 13739 } 13740 { 13741 var x int64 = 0 13742 var y int64 = 9223372036854775807 13743 if x == y { 13744 t.Errorf("%d == %d", x, y) 13745 } 13746 if !(x != y) { 13747 t.Errorf("!(%d != %d)", x, y) 13748 } 13749 if !(x < y) { 13750 t.Errorf("!(%d < %d)", x, y) 13751 } 13752 if x > y { 13753 t.Errorf("%d > %d", x, y) 13754 } 13755 if !(x <= y) { 13756 t.Errorf("!(%d <= %d)", x, y) 13757 } 13758 if x >= y { 13759 t.Errorf("%d >= %d", x, y) 13760 } 13761 } 13762 { 13763 var x int64 = 1 13764 var y int64 = -9223372036854775808 13765 if x == y { 13766 t.Errorf("%d == %d", x, y) 13767 } 13768 if !(x != y) { 13769 t.Errorf("!(%d != %d)", x, y) 13770 } 13771 if x < y { 13772 t.Errorf("%d < %d", x, y) 13773 } 13774 if !(x > y) { 13775 t.Errorf("!(%d > %d)", x, y) 13776 } 13777 if x <= y { 13778 t.Errorf("%d <= %d", x, y) 13779 } 13780 if !(x >= y) { 13781 t.Errorf("!(%d >= %d)", x, y) 13782 } 13783 } 13784 { 13785 var x int64 = 1 13786 var y int64 = -9223372036854775807 13787 if x == y { 13788 t.Errorf("%d == %d", x, y) 13789 } 13790 if !(x != y) { 13791 t.Errorf("!(%d != %d)", x, y) 13792 } 13793 if x < y { 13794 t.Errorf("%d < %d", x, y) 13795 } 13796 if !(x > y) { 13797 t.Errorf("!(%d > %d)", x, y) 13798 } 13799 if x <= y { 13800 t.Errorf("%d <= %d", x, y) 13801 } 13802 if !(x >= y) { 13803 t.Errorf("!(%d >= %d)", x, y) 13804 } 13805 } 13806 { 13807 var x int64 = 1 13808 var y int64 = -4294967296 13809 if x == y { 13810 t.Errorf("%d == %d", x, y) 13811 } 13812 if !(x != y) { 13813 t.Errorf("!(%d != %d)", x, y) 13814 } 13815 if x < y { 13816 t.Errorf("%d < %d", x, y) 13817 } 13818 if !(x > y) { 13819 t.Errorf("!(%d > %d)", x, y) 13820 } 13821 if x <= y { 13822 t.Errorf("%d <= %d", x, y) 13823 } 13824 if !(x >= y) { 13825 t.Errorf("!(%d >= %d)", x, y) 13826 } 13827 } 13828 { 13829 var x int64 = 1 13830 var y int64 = -1 13831 if x == y { 13832 t.Errorf("%d == %d", x, y) 13833 } 13834 if !(x != y) { 13835 t.Errorf("!(%d != %d)", x, y) 13836 } 13837 if x < y { 13838 t.Errorf("%d < %d", x, y) 13839 } 13840 if !(x > y) { 13841 t.Errorf("!(%d > %d)", x, y) 13842 } 13843 if x <= y { 13844 t.Errorf("%d <= %d", x, y) 13845 } 13846 if !(x >= y) { 13847 t.Errorf("!(%d >= %d)", x, y) 13848 } 13849 } 13850 { 13851 var x int64 = 1 13852 var y int64 = 0 13853 if x == y { 13854 t.Errorf("%d == %d", x, y) 13855 } 13856 if !(x != y) { 13857 t.Errorf("!(%d != %d)", x, y) 13858 } 13859 if x < y { 13860 t.Errorf("%d < %d", x, y) 13861 } 13862 if !(x > y) { 13863 t.Errorf("!(%d > %d)", x, y) 13864 } 13865 if x <= y { 13866 t.Errorf("%d <= %d", x, y) 13867 } 13868 if !(x >= y) { 13869 t.Errorf("!(%d >= %d)", x, y) 13870 } 13871 } 13872 { 13873 var x int64 = 1 13874 var y int64 = 1 13875 if !(x == y) { 13876 t.Errorf("!(%d == %d)", x, y) 13877 } 13878 if x != y { 13879 t.Errorf("%d != %d", x, y) 13880 } 13881 if x < y { 13882 t.Errorf("%d < %d", x, y) 13883 } 13884 if x > y { 13885 t.Errorf("%d > %d", x, y) 13886 } 13887 if !(x <= y) { 13888 t.Errorf("!(%d <= %d)", x, y) 13889 } 13890 if !(x >= y) { 13891 t.Errorf("!(%d >= %d)", x, y) 13892 } 13893 } 13894 { 13895 var x int64 = 1 13896 var y int64 = 4294967296 13897 if x == y { 13898 t.Errorf("%d == %d", x, y) 13899 } 13900 if !(x != y) { 13901 t.Errorf("!(%d != %d)", x, y) 13902 } 13903 if !(x < y) { 13904 t.Errorf("!(%d < %d)", x, y) 13905 } 13906 if x > y { 13907 t.Errorf("%d > %d", x, y) 13908 } 13909 if !(x <= y) { 13910 t.Errorf("!(%d <= %d)", x, y) 13911 } 13912 if x >= y { 13913 t.Errorf("%d >= %d", x, y) 13914 } 13915 } 13916 { 13917 var x int64 = 1 13918 var y int64 = 9223372036854775806 13919 if x == y { 13920 t.Errorf("%d == %d", x, y) 13921 } 13922 if !(x != y) { 13923 t.Errorf("!(%d != %d)", x, y) 13924 } 13925 if !(x < y) { 13926 t.Errorf("!(%d < %d)", x, y) 13927 } 13928 if x > y { 13929 t.Errorf("%d > %d", x, y) 13930 } 13931 if !(x <= y) { 13932 t.Errorf("!(%d <= %d)", x, y) 13933 } 13934 if x >= y { 13935 t.Errorf("%d >= %d", x, y) 13936 } 13937 } 13938 { 13939 var x int64 = 1 13940 var y int64 = 9223372036854775807 13941 if x == y { 13942 t.Errorf("%d == %d", x, y) 13943 } 13944 if !(x != y) { 13945 t.Errorf("!(%d != %d)", x, y) 13946 } 13947 if !(x < y) { 13948 t.Errorf("!(%d < %d)", x, y) 13949 } 13950 if x > y { 13951 t.Errorf("%d > %d", x, y) 13952 } 13953 if !(x <= y) { 13954 t.Errorf("!(%d <= %d)", x, y) 13955 } 13956 if x >= y { 13957 t.Errorf("%d >= %d", x, y) 13958 } 13959 } 13960 { 13961 var x int64 = 4294967296 13962 var y int64 = -9223372036854775808 13963 if x == y { 13964 t.Errorf("%d == %d", x, y) 13965 } 13966 if !(x != y) { 13967 t.Errorf("!(%d != %d)", x, y) 13968 } 13969 if x < y { 13970 t.Errorf("%d < %d", x, y) 13971 } 13972 if !(x > y) { 13973 t.Errorf("!(%d > %d)", x, y) 13974 } 13975 if x <= y { 13976 t.Errorf("%d <= %d", x, y) 13977 } 13978 if !(x >= y) { 13979 t.Errorf("!(%d >= %d)", x, y) 13980 } 13981 } 13982 { 13983 var x int64 = 4294967296 13984 var y int64 = -9223372036854775807 13985 if x == y { 13986 t.Errorf("%d == %d", x, y) 13987 } 13988 if !(x != y) { 13989 t.Errorf("!(%d != %d)", x, y) 13990 } 13991 if x < y { 13992 t.Errorf("%d < %d", x, y) 13993 } 13994 if !(x > y) { 13995 t.Errorf("!(%d > %d)", x, y) 13996 } 13997 if x <= y { 13998 t.Errorf("%d <= %d", x, y) 13999 } 14000 if !(x >= y) { 14001 t.Errorf("!(%d >= %d)", x, y) 14002 } 14003 } 14004 { 14005 var x int64 = 4294967296 14006 var y int64 = -4294967296 14007 if x == y { 14008 t.Errorf("%d == %d", x, y) 14009 } 14010 if !(x != y) { 14011 t.Errorf("!(%d != %d)", x, y) 14012 } 14013 if x < y { 14014 t.Errorf("%d < %d", x, y) 14015 } 14016 if !(x > y) { 14017 t.Errorf("!(%d > %d)", x, y) 14018 } 14019 if x <= y { 14020 t.Errorf("%d <= %d", x, y) 14021 } 14022 if !(x >= y) { 14023 t.Errorf("!(%d >= %d)", x, y) 14024 } 14025 } 14026 { 14027 var x int64 = 4294967296 14028 var y int64 = -1 14029 if x == y { 14030 t.Errorf("%d == %d", x, y) 14031 } 14032 if !(x != y) { 14033 t.Errorf("!(%d != %d)", x, y) 14034 } 14035 if x < y { 14036 t.Errorf("%d < %d", x, y) 14037 } 14038 if !(x > y) { 14039 t.Errorf("!(%d > %d)", x, y) 14040 } 14041 if x <= y { 14042 t.Errorf("%d <= %d", x, y) 14043 } 14044 if !(x >= y) { 14045 t.Errorf("!(%d >= %d)", x, y) 14046 } 14047 } 14048 { 14049 var x int64 = 4294967296 14050 var y int64 = 0 14051 if x == y { 14052 t.Errorf("%d == %d", x, y) 14053 } 14054 if !(x != y) { 14055 t.Errorf("!(%d != %d)", x, y) 14056 } 14057 if x < y { 14058 t.Errorf("%d < %d", x, y) 14059 } 14060 if !(x > y) { 14061 t.Errorf("!(%d > %d)", x, y) 14062 } 14063 if x <= y { 14064 t.Errorf("%d <= %d", x, y) 14065 } 14066 if !(x >= y) { 14067 t.Errorf("!(%d >= %d)", x, y) 14068 } 14069 } 14070 { 14071 var x int64 = 4294967296 14072 var y int64 = 1 14073 if x == y { 14074 t.Errorf("%d == %d", x, y) 14075 } 14076 if !(x != y) { 14077 t.Errorf("!(%d != %d)", x, y) 14078 } 14079 if x < y { 14080 t.Errorf("%d < %d", x, y) 14081 } 14082 if !(x > y) { 14083 t.Errorf("!(%d > %d)", x, y) 14084 } 14085 if x <= y { 14086 t.Errorf("%d <= %d", x, y) 14087 } 14088 if !(x >= y) { 14089 t.Errorf("!(%d >= %d)", x, y) 14090 } 14091 } 14092 { 14093 var x int64 = 4294967296 14094 var y int64 = 4294967296 14095 if !(x == y) { 14096 t.Errorf("!(%d == %d)", x, y) 14097 } 14098 if x != y { 14099 t.Errorf("%d != %d", x, y) 14100 } 14101 if x < y { 14102 t.Errorf("%d < %d", x, y) 14103 } 14104 if x > y { 14105 t.Errorf("%d > %d", x, y) 14106 } 14107 if !(x <= y) { 14108 t.Errorf("!(%d <= %d)", x, y) 14109 } 14110 if !(x >= y) { 14111 t.Errorf("!(%d >= %d)", x, y) 14112 } 14113 } 14114 { 14115 var x int64 = 4294967296 14116 var y int64 = 9223372036854775806 14117 if x == y { 14118 t.Errorf("%d == %d", x, y) 14119 } 14120 if !(x != y) { 14121 t.Errorf("!(%d != %d)", x, y) 14122 } 14123 if !(x < y) { 14124 t.Errorf("!(%d < %d)", x, y) 14125 } 14126 if x > y { 14127 t.Errorf("%d > %d", x, y) 14128 } 14129 if !(x <= y) { 14130 t.Errorf("!(%d <= %d)", x, y) 14131 } 14132 if x >= y { 14133 t.Errorf("%d >= %d", x, y) 14134 } 14135 } 14136 { 14137 var x int64 = 4294967296 14138 var y int64 = 9223372036854775807 14139 if x == y { 14140 t.Errorf("%d == %d", x, y) 14141 } 14142 if !(x != y) { 14143 t.Errorf("!(%d != %d)", x, y) 14144 } 14145 if !(x < y) { 14146 t.Errorf("!(%d < %d)", x, y) 14147 } 14148 if x > y { 14149 t.Errorf("%d > %d", x, y) 14150 } 14151 if !(x <= y) { 14152 t.Errorf("!(%d <= %d)", x, y) 14153 } 14154 if x >= y { 14155 t.Errorf("%d >= %d", x, y) 14156 } 14157 } 14158 { 14159 var x int64 = 9223372036854775806 14160 var y int64 = -9223372036854775808 14161 if x == y { 14162 t.Errorf("%d == %d", x, y) 14163 } 14164 if !(x != y) { 14165 t.Errorf("!(%d != %d)", x, y) 14166 } 14167 if x < y { 14168 t.Errorf("%d < %d", x, y) 14169 } 14170 if !(x > y) { 14171 t.Errorf("!(%d > %d)", x, y) 14172 } 14173 if x <= y { 14174 t.Errorf("%d <= %d", x, y) 14175 } 14176 if !(x >= y) { 14177 t.Errorf("!(%d >= %d)", x, y) 14178 } 14179 } 14180 { 14181 var x int64 = 9223372036854775806 14182 var y int64 = -9223372036854775807 14183 if x == y { 14184 t.Errorf("%d == %d", x, y) 14185 } 14186 if !(x != y) { 14187 t.Errorf("!(%d != %d)", x, y) 14188 } 14189 if x < y { 14190 t.Errorf("%d < %d", x, y) 14191 } 14192 if !(x > y) { 14193 t.Errorf("!(%d > %d)", x, y) 14194 } 14195 if x <= y { 14196 t.Errorf("%d <= %d", x, y) 14197 } 14198 if !(x >= y) { 14199 t.Errorf("!(%d >= %d)", x, y) 14200 } 14201 } 14202 { 14203 var x int64 = 9223372036854775806 14204 var y int64 = -4294967296 14205 if x == y { 14206 t.Errorf("%d == %d", x, y) 14207 } 14208 if !(x != y) { 14209 t.Errorf("!(%d != %d)", x, y) 14210 } 14211 if x < y { 14212 t.Errorf("%d < %d", x, y) 14213 } 14214 if !(x > y) { 14215 t.Errorf("!(%d > %d)", x, y) 14216 } 14217 if x <= y { 14218 t.Errorf("%d <= %d", x, y) 14219 } 14220 if !(x >= y) { 14221 t.Errorf("!(%d >= %d)", x, y) 14222 } 14223 } 14224 { 14225 var x int64 = 9223372036854775806 14226 var y int64 = -1 14227 if x == y { 14228 t.Errorf("%d == %d", x, y) 14229 } 14230 if !(x != y) { 14231 t.Errorf("!(%d != %d)", x, y) 14232 } 14233 if x < y { 14234 t.Errorf("%d < %d", x, y) 14235 } 14236 if !(x > y) { 14237 t.Errorf("!(%d > %d)", x, y) 14238 } 14239 if x <= y { 14240 t.Errorf("%d <= %d", x, y) 14241 } 14242 if !(x >= y) { 14243 t.Errorf("!(%d >= %d)", x, y) 14244 } 14245 } 14246 { 14247 var x int64 = 9223372036854775806 14248 var y int64 = 0 14249 if x == y { 14250 t.Errorf("%d == %d", x, y) 14251 } 14252 if !(x != y) { 14253 t.Errorf("!(%d != %d)", x, y) 14254 } 14255 if x < y { 14256 t.Errorf("%d < %d", x, y) 14257 } 14258 if !(x > y) { 14259 t.Errorf("!(%d > %d)", x, y) 14260 } 14261 if x <= y { 14262 t.Errorf("%d <= %d", x, y) 14263 } 14264 if !(x >= y) { 14265 t.Errorf("!(%d >= %d)", x, y) 14266 } 14267 } 14268 { 14269 var x int64 = 9223372036854775806 14270 var y int64 = 1 14271 if x == y { 14272 t.Errorf("%d == %d", x, y) 14273 } 14274 if !(x != y) { 14275 t.Errorf("!(%d != %d)", x, y) 14276 } 14277 if x < y { 14278 t.Errorf("%d < %d", x, y) 14279 } 14280 if !(x > y) { 14281 t.Errorf("!(%d > %d)", x, y) 14282 } 14283 if x <= y { 14284 t.Errorf("%d <= %d", x, y) 14285 } 14286 if !(x >= y) { 14287 t.Errorf("!(%d >= %d)", x, y) 14288 } 14289 } 14290 { 14291 var x int64 = 9223372036854775806 14292 var y int64 = 4294967296 14293 if x == y { 14294 t.Errorf("%d == %d", x, y) 14295 } 14296 if !(x != y) { 14297 t.Errorf("!(%d != %d)", x, y) 14298 } 14299 if x < y { 14300 t.Errorf("%d < %d", x, y) 14301 } 14302 if !(x > y) { 14303 t.Errorf("!(%d > %d)", x, y) 14304 } 14305 if x <= y { 14306 t.Errorf("%d <= %d", x, y) 14307 } 14308 if !(x >= y) { 14309 t.Errorf("!(%d >= %d)", x, y) 14310 } 14311 } 14312 { 14313 var x int64 = 9223372036854775806 14314 var y int64 = 9223372036854775806 14315 if !(x == y) { 14316 t.Errorf("!(%d == %d)", x, y) 14317 } 14318 if x != y { 14319 t.Errorf("%d != %d", x, y) 14320 } 14321 if x < y { 14322 t.Errorf("%d < %d", x, y) 14323 } 14324 if x > y { 14325 t.Errorf("%d > %d", x, y) 14326 } 14327 if !(x <= y) { 14328 t.Errorf("!(%d <= %d)", x, y) 14329 } 14330 if !(x >= y) { 14331 t.Errorf("!(%d >= %d)", x, y) 14332 } 14333 } 14334 { 14335 var x int64 = 9223372036854775806 14336 var y int64 = 9223372036854775807 14337 if x == y { 14338 t.Errorf("%d == %d", x, y) 14339 } 14340 if !(x != y) { 14341 t.Errorf("!(%d != %d)", x, y) 14342 } 14343 if !(x < y) { 14344 t.Errorf("!(%d < %d)", x, y) 14345 } 14346 if x > y { 14347 t.Errorf("%d > %d", x, y) 14348 } 14349 if !(x <= y) { 14350 t.Errorf("!(%d <= %d)", x, y) 14351 } 14352 if x >= y { 14353 t.Errorf("%d >= %d", x, y) 14354 } 14355 } 14356 { 14357 var x int64 = 9223372036854775807 14358 var y int64 = -9223372036854775808 14359 if x == y { 14360 t.Errorf("%d == %d", x, y) 14361 } 14362 if !(x != y) { 14363 t.Errorf("!(%d != %d)", x, y) 14364 } 14365 if x < y { 14366 t.Errorf("%d < %d", x, y) 14367 } 14368 if !(x > y) { 14369 t.Errorf("!(%d > %d)", x, y) 14370 } 14371 if x <= y { 14372 t.Errorf("%d <= %d", x, y) 14373 } 14374 if !(x >= y) { 14375 t.Errorf("!(%d >= %d)", x, y) 14376 } 14377 } 14378 { 14379 var x int64 = 9223372036854775807 14380 var y int64 = -9223372036854775807 14381 if x == y { 14382 t.Errorf("%d == %d", x, y) 14383 } 14384 if !(x != y) { 14385 t.Errorf("!(%d != %d)", x, y) 14386 } 14387 if x < y { 14388 t.Errorf("%d < %d", x, y) 14389 } 14390 if !(x > y) { 14391 t.Errorf("!(%d > %d)", x, y) 14392 } 14393 if x <= y { 14394 t.Errorf("%d <= %d", x, y) 14395 } 14396 if !(x >= y) { 14397 t.Errorf("!(%d >= %d)", x, y) 14398 } 14399 } 14400 { 14401 var x int64 = 9223372036854775807 14402 var y int64 = -4294967296 14403 if x == y { 14404 t.Errorf("%d == %d", x, y) 14405 } 14406 if !(x != y) { 14407 t.Errorf("!(%d != %d)", x, y) 14408 } 14409 if x < y { 14410 t.Errorf("%d < %d", x, y) 14411 } 14412 if !(x > y) { 14413 t.Errorf("!(%d > %d)", x, y) 14414 } 14415 if x <= y { 14416 t.Errorf("%d <= %d", x, y) 14417 } 14418 if !(x >= y) { 14419 t.Errorf("!(%d >= %d)", x, y) 14420 } 14421 } 14422 { 14423 var x int64 = 9223372036854775807 14424 var y int64 = -1 14425 if x == y { 14426 t.Errorf("%d == %d", x, y) 14427 } 14428 if !(x != y) { 14429 t.Errorf("!(%d != %d)", x, y) 14430 } 14431 if x < y { 14432 t.Errorf("%d < %d", x, y) 14433 } 14434 if !(x > y) { 14435 t.Errorf("!(%d > %d)", x, y) 14436 } 14437 if x <= y { 14438 t.Errorf("%d <= %d", x, y) 14439 } 14440 if !(x >= y) { 14441 t.Errorf("!(%d >= %d)", x, y) 14442 } 14443 } 14444 { 14445 var x int64 = 9223372036854775807 14446 var y int64 = 0 14447 if x == y { 14448 t.Errorf("%d == %d", x, y) 14449 } 14450 if !(x != y) { 14451 t.Errorf("!(%d != %d)", x, y) 14452 } 14453 if x < y { 14454 t.Errorf("%d < %d", x, y) 14455 } 14456 if !(x > y) { 14457 t.Errorf("!(%d > %d)", x, y) 14458 } 14459 if x <= y { 14460 t.Errorf("%d <= %d", x, y) 14461 } 14462 if !(x >= y) { 14463 t.Errorf("!(%d >= %d)", x, y) 14464 } 14465 } 14466 { 14467 var x int64 = 9223372036854775807 14468 var y int64 = 1 14469 if x == y { 14470 t.Errorf("%d == %d", x, y) 14471 } 14472 if !(x != y) { 14473 t.Errorf("!(%d != %d)", x, y) 14474 } 14475 if x < y { 14476 t.Errorf("%d < %d", x, y) 14477 } 14478 if !(x > y) { 14479 t.Errorf("!(%d > %d)", x, y) 14480 } 14481 if x <= y { 14482 t.Errorf("%d <= %d", x, y) 14483 } 14484 if !(x >= y) { 14485 t.Errorf("!(%d >= %d)", x, y) 14486 } 14487 } 14488 { 14489 var x int64 = 9223372036854775807 14490 var y int64 = 4294967296 14491 if x == y { 14492 t.Errorf("%d == %d", x, y) 14493 } 14494 if !(x != y) { 14495 t.Errorf("!(%d != %d)", x, y) 14496 } 14497 if x < y { 14498 t.Errorf("%d < %d", x, y) 14499 } 14500 if !(x > y) { 14501 t.Errorf("!(%d > %d)", x, y) 14502 } 14503 if x <= y { 14504 t.Errorf("%d <= %d", x, y) 14505 } 14506 if !(x >= y) { 14507 t.Errorf("!(%d >= %d)", x, y) 14508 } 14509 } 14510 { 14511 var x int64 = 9223372036854775807 14512 var y int64 = 9223372036854775806 14513 if x == y { 14514 t.Errorf("%d == %d", x, y) 14515 } 14516 if !(x != y) { 14517 t.Errorf("!(%d != %d)", x, y) 14518 } 14519 if x < y { 14520 t.Errorf("%d < %d", x, y) 14521 } 14522 if !(x > y) { 14523 t.Errorf("!(%d > %d)", x, y) 14524 } 14525 if x <= y { 14526 t.Errorf("%d <= %d", x, y) 14527 } 14528 if !(x >= y) { 14529 t.Errorf("!(%d >= %d)", x, y) 14530 } 14531 } 14532 { 14533 var x int64 = 9223372036854775807 14534 var y int64 = 9223372036854775807 14535 if !(x == y) { 14536 t.Errorf("!(%d == %d)", x, y) 14537 } 14538 if x != y { 14539 t.Errorf("%d != %d", x, y) 14540 } 14541 if x < y { 14542 t.Errorf("%d < %d", x, y) 14543 } 14544 if x > y { 14545 t.Errorf("%d > %d", x, y) 14546 } 14547 if !(x <= y) { 14548 t.Errorf("!(%d <= %d)", x, y) 14549 } 14550 if !(x >= y) { 14551 t.Errorf("!(%d >= %d)", x, y) 14552 } 14553 } 14554 } 14555 func TestConstFoldCompareuint32(t *testing.T) { 14556 { 14557 var x uint32 = 0 14558 var y uint32 = 0 14559 if !(x == y) { 14560 t.Errorf("!(%d == %d)", x, y) 14561 } 14562 if x != y { 14563 t.Errorf("%d != %d", x, y) 14564 } 14565 if x < y { 14566 t.Errorf("%d < %d", x, y) 14567 } 14568 if x > y { 14569 t.Errorf("%d > %d", x, y) 14570 } 14571 if !(x <= y) { 14572 t.Errorf("!(%d <= %d)", x, y) 14573 } 14574 if !(x >= y) { 14575 t.Errorf("!(%d >= %d)", x, y) 14576 } 14577 } 14578 { 14579 var x uint32 = 0 14580 var y uint32 = 1 14581 if x == y { 14582 t.Errorf("%d == %d", x, y) 14583 } 14584 if !(x != y) { 14585 t.Errorf("!(%d != %d)", x, y) 14586 } 14587 if !(x < y) { 14588 t.Errorf("!(%d < %d)", x, y) 14589 } 14590 if x > y { 14591 t.Errorf("%d > %d", x, y) 14592 } 14593 if !(x <= y) { 14594 t.Errorf("!(%d <= %d)", x, y) 14595 } 14596 if x >= y { 14597 t.Errorf("%d >= %d", x, y) 14598 } 14599 } 14600 { 14601 var x uint32 = 0 14602 var y uint32 = 4294967295 14603 if x == y { 14604 t.Errorf("%d == %d", x, y) 14605 } 14606 if !(x != y) { 14607 t.Errorf("!(%d != %d)", x, y) 14608 } 14609 if !(x < y) { 14610 t.Errorf("!(%d < %d)", x, y) 14611 } 14612 if x > y { 14613 t.Errorf("%d > %d", x, y) 14614 } 14615 if !(x <= y) { 14616 t.Errorf("!(%d <= %d)", x, y) 14617 } 14618 if x >= y { 14619 t.Errorf("%d >= %d", x, y) 14620 } 14621 } 14622 { 14623 var x uint32 = 1 14624 var y uint32 = 0 14625 if x == y { 14626 t.Errorf("%d == %d", x, y) 14627 } 14628 if !(x != y) { 14629 t.Errorf("!(%d != %d)", x, y) 14630 } 14631 if x < y { 14632 t.Errorf("%d < %d", x, y) 14633 } 14634 if !(x > y) { 14635 t.Errorf("!(%d > %d)", x, y) 14636 } 14637 if x <= y { 14638 t.Errorf("%d <= %d", x, y) 14639 } 14640 if !(x >= y) { 14641 t.Errorf("!(%d >= %d)", x, y) 14642 } 14643 } 14644 { 14645 var x uint32 = 1 14646 var y uint32 = 1 14647 if !(x == y) { 14648 t.Errorf("!(%d == %d)", x, y) 14649 } 14650 if x != y { 14651 t.Errorf("%d != %d", x, y) 14652 } 14653 if x < y { 14654 t.Errorf("%d < %d", x, y) 14655 } 14656 if x > y { 14657 t.Errorf("%d > %d", x, y) 14658 } 14659 if !(x <= y) { 14660 t.Errorf("!(%d <= %d)", x, y) 14661 } 14662 if !(x >= y) { 14663 t.Errorf("!(%d >= %d)", x, y) 14664 } 14665 } 14666 { 14667 var x uint32 = 1 14668 var y uint32 = 4294967295 14669 if x == y { 14670 t.Errorf("%d == %d", x, y) 14671 } 14672 if !(x != y) { 14673 t.Errorf("!(%d != %d)", x, y) 14674 } 14675 if !(x < y) { 14676 t.Errorf("!(%d < %d)", x, y) 14677 } 14678 if x > y { 14679 t.Errorf("%d > %d", x, y) 14680 } 14681 if !(x <= y) { 14682 t.Errorf("!(%d <= %d)", x, y) 14683 } 14684 if x >= y { 14685 t.Errorf("%d >= %d", x, y) 14686 } 14687 } 14688 { 14689 var x uint32 = 4294967295 14690 var y uint32 = 0 14691 if x == y { 14692 t.Errorf("%d == %d", x, y) 14693 } 14694 if !(x != y) { 14695 t.Errorf("!(%d != %d)", x, y) 14696 } 14697 if x < y { 14698 t.Errorf("%d < %d", x, y) 14699 } 14700 if !(x > y) { 14701 t.Errorf("!(%d > %d)", x, y) 14702 } 14703 if x <= y { 14704 t.Errorf("%d <= %d", x, y) 14705 } 14706 if !(x >= y) { 14707 t.Errorf("!(%d >= %d)", x, y) 14708 } 14709 } 14710 { 14711 var x uint32 = 4294967295 14712 var y uint32 = 1 14713 if x == y { 14714 t.Errorf("%d == %d", x, y) 14715 } 14716 if !(x != y) { 14717 t.Errorf("!(%d != %d)", x, y) 14718 } 14719 if x < y { 14720 t.Errorf("%d < %d", x, y) 14721 } 14722 if !(x > y) { 14723 t.Errorf("!(%d > %d)", x, y) 14724 } 14725 if x <= y { 14726 t.Errorf("%d <= %d", x, y) 14727 } 14728 if !(x >= y) { 14729 t.Errorf("!(%d >= %d)", x, y) 14730 } 14731 } 14732 { 14733 var x uint32 = 4294967295 14734 var y uint32 = 4294967295 14735 if !(x == y) { 14736 t.Errorf("!(%d == %d)", x, y) 14737 } 14738 if x != y { 14739 t.Errorf("%d != %d", x, y) 14740 } 14741 if x < y { 14742 t.Errorf("%d < %d", x, y) 14743 } 14744 if x > y { 14745 t.Errorf("%d > %d", x, y) 14746 } 14747 if !(x <= y) { 14748 t.Errorf("!(%d <= %d)", x, y) 14749 } 14750 if !(x >= y) { 14751 t.Errorf("!(%d >= %d)", x, y) 14752 } 14753 } 14754 } 14755 func TestConstFoldCompareint32(t *testing.T) { 14756 { 14757 var x int32 = -2147483648 14758 var y int32 = -2147483648 14759 if !(x == y) { 14760 t.Errorf("!(%d == %d)", x, y) 14761 } 14762 if x != y { 14763 t.Errorf("%d != %d", x, y) 14764 } 14765 if x < y { 14766 t.Errorf("%d < %d", x, y) 14767 } 14768 if x > y { 14769 t.Errorf("%d > %d", x, y) 14770 } 14771 if !(x <= y) { 14772 t.Errorf("!(%d <= %d)", x, y) 14773 } 14774 if !(x >= y) { 14775 t.Errorf("!(%d >= %d)", x, y) 14776 } 14777 } 14778 { 14779 var x int32 = -2147483648 14780 var y int32 = -2147483647 14781 if x == y { 14782 t.Errorf("%d == %d", x, y) 14783 } 14784 if !(x != y) { 14785 t.Errorf("!(%d != %d)", x, y) 14786 } 14787 if !(x < y) { 14788 t.Errorf("!(%d < %d)", x, y) 14789 } 14790 if x > y { 14791 t.Errorf("%d > %d", x, y) 14792 } 14793 if !(x <= y) { 14794 t.Errorf("!(%d <= %d)", x, y) 14795 } 14796 if x >= y { 14797 t.Errorf("%d >= %d", x, y) 14798 } 14799 } 14800 { 14801 var x int32 = -2147483648 14802 var y int32 = -1 14803 if x == y { 14804 t.Errorf("%d == %d", x, y) 14805 } 14806 if !(x != y) { 14807 t.Errorf("!(%d != %d)", x, y) 14808 } 14809 if !(x < y) { 14810 t.Errorf("!(%d < %d)", x, y) 14811 } 14812 if x > y { 14813 t.Errorf("%d > %d", x, y) 14814 } 14815 if !(x <= y) { 14816 t.Errorf("!(%d <= %d)", x, y) 14817 } 14818 if x >= y { 14819 t.Errorf("%d >= %d", x, y) 14820 } 14821 } 14822 { 14823 var x int32 = -2147483648 14824 var y int32 = 0 14825 if x == y { 14826 t.Errorf("%d == %d", x, y) 14827 } 14828 if !(x != y) { 14829 t.Errorf("!(%d != %d)", x, y) 14830 } 14831 if !(x < y) { 14832 t.Errorf("!(%d < %d)", x, y) 14833 } 14834 if x > y { 14835 t.Errorf("%d > %d", x, y) 14836 } 14837 if !(x <= y) { 14838 t.Errorf("!(%d <= %d)", x, y) 14839 } 14840 if x >= y { 14841 t.Errorf("%d >= %d", x, y) 14842 } 14843 } 14844 { 14845 var x int32 = -2147483648 14846 var y int32 = 1 14847 if x == y { 14848 t.Errorf("%d == %d", x, y) 14849 } 14850 if !(x != y) { 14851 t.Errorf("!(%d != %d)", x, y) 14852 } 14853 if !(x < y) { 14854 t.Errorf("!(%d < %d)", x, y) 14855 } 14856 if x > y { 14857 t.Errorf("%d > %d", x, y) 14858 } 14859 if !(x <= y) { 14860 t.Errorf("!(%d <= %d)", x, y) 14861 } 14862 if x >= y { 14863 t.Errorf("%d >= %d", x, y) 14864 } 14865 } 14866 { 14867 var x int32 = -2147483648 14868 var y int32 = 2147483647 14869 if x == y { 14870 t.Errorf("%d == %d", x, y) 14871 } 14872 if !(x != y) { 14873 t.Errorf("!(%d != %d)", x, y) 14874 } 14875 if !(x < y) { 14876 t.Errorf("!(%d < %d)", x, y) 14877 } 14878 if x > y { 14879 t.Errorf("%d > %d", x, y) 14880 } 14881 if !(x <= y) { 14882 t.Errorf("!(%d <= %d)", x, y) 14883 } 14884 if x >= y { 14885 t.Errorf("%d >= %d", x, y) 14886 } 14887 } 14888 { 14889 var x int32 = -2147483647 14890 var y int32 = -2147483648 14891 if x == y { 14892 t.Errorf("%d == %d", x, y) 14893 } 14894 if !(x != y) { 14895 t.Errorf("!(%d != %d)", x, y) 14896 } 14897 if x < y { 14898 t.Errorf("%d < %d", x, y) 14899 } 14900 if !(x > y) { 14901 t.Errorf("!(%d > %d)", x, y) 14902 } 14903 if x <= y { 14904 t.Errorf("%d <= %d", x, y) 14905 } 14906 if !(x >= y) { 14907 t.Errorf("!(%d >= %d)", x, y) 14908 } 14909 } 14910 { 14911 var x int32 = -2147483647 14912 var y int32 = -2147483647 14913 if !(x == y) { 14914 t.Errorf("!(%d == %d)", x, y) 14915 } 14916 if x != y { 14917 t.Errorf("%d != %d", x, y) 14918 } 14919 if x < y { 14920 t.Errorf("%d < %d", x, y) 14921 } 14922 if x > y { 14923 t.Errorf("%d > %d", x, y) 14924 } 14925 if !(x <= y) { 14926 t.Errorf("!(%d <= %d)", x, y) 14927 } 14928 if !(x >= y) { 14929 t.Errorf("!(%d >= %d)", x, y) 14930 } 14931 } 14932 { 14933 var x int32 = -2147483647 14934 var y int32 = -1 14935 if x == y { 14936 t.Errorf("%d == %d", x, y) 14937 } 14938 if !(x != y) { 14939 t.Errorf("!(%d != %d)", x, y) 14940 } 14941 if !(x < y) { 14942 t.Errorf("!(%d < %d)", x, y) 14943 } 14944 if x > y { 14945 t.Errorf("%d > %d", x, y) 14946 } 14947 if !(x <= y) { 14948 t.Errorf("!(%d <= %d)", x, y) 14949 } 14950 if x >= y { 14951 t.Errorf("%d >= %d", x, y) 14952 } 14953 } 14954 { 14955 var x int32 = -2147483647 14956 var y int32 = 0 14957 if x == y { 14958 t.Errorf("%d == %d", x, y) 14959 } 14960 if !(x != y) { 14961 t.Errorf("!(%d != %d)", x, y) 14962 } 14963 if !(x < y) { 14964 t.Errorf("!(%d < %d)", x, y) 14965 } 14966 if x > y { 14967 t.Errorf("%d > %d", x, y) 14968 } 14969 if !(x <= y) { 14970 t.Errorf("!(%d <= %d)", x, y) 14971 } 14972 if x >= y { 14973 t.Errorf("%d >= %d", x, y) 14974 } 14975 } 14976 { 14977 var x int32 = -2147483647 14978 var y int32 = 1 14979 if x == y { 14980 t.Errorf("%d == %d", x, y) 14981 } 14982 if !(x != y) { 14983 t.Errorf("!(%d != %d)", x, y) 14984 } 14985 if !(x < y) { 14986 t.Errorf("!(%d < %d)", x, y) 14987 } 14988 if x > y { 14989 t.Errorf("%d > %d", x, y) 14990 } 14991 if !(x <= y) { 14992 t.Errorf("!(%d <= %d)", x, y) 14993 } 14994 if x >= y { 14995 t.Errorf("%d >= %d", x, y) 14996 } 14997 } 14998 { 14999 var x int32 = -2147483647 15000 var y int32 = 2147483647 15001 if x == y { 15002 t.Errorf("%d == %d", x, y) 15003 } 15004 if !(x != y) { 15005 t.Errorf("!(%d != %d)", x, y) 15006 } 15007 if !(x < y) { 15008 t.Errorf("!(%d < %d)", x, y) 15009 } 15010 if x > y { 15011 t.Errorf("%d > %d", x, y) 15012 } 15013 if !(x <= y) { 15014 t.Errorf("!(%d <= %d)", x, y) 15015 } 15016 if x >= y { 15017 t.Errorf("%d >= %d", x, y) 15018 } 15019 } 15020 { 15021 var x int32 = -1 15022 var y int32 = -2147483648 15023 if x == y { 15024 t.Errorf("%d == %d", x, y) 15025 } 15026 if !(x != y) { 15027 t.Errorf("!(%d != %d)", x, y) 15028 } 15029 if x < y { 15030 t.Errorf("%d < %d", x, y) 15031 } 15032 if !(x > y) { 15033 t.Errorf("!(%d > %d)", x, y) 15034 } 15035 if x <= y { 15036 t.Errorf("%d <= %d", x, y) 15037 } 15038 if !(x >= y) { 15039 t.Errorf("!(%d >= %d)", x, y) 15040 } 15041 } 15042 { 15043 var x int32 = -1 15044 var y int32 = -2147483647 15045 if x == y { 15046 t.Errorf("%d == %d", x, y) 15047 } 15048 if !(x != y) { 15049 t.Errorf("!(%d != %d)", x, y) 15050 } 15051 if x < y { 15052 t.Errorf("%d < %d", x, y) 15053 } 15054 if !(x > y) { 15055 t.Errorf("!(%d > %d)", x, y) 15056 } 15057 if x <= y { 15058 t.Errorf("%d <= %d", x, y) 15059 } 15060 if !(x >= y) { 15061 t.Errorf("!(%d >= %d)", x, y) 15062 } 15063 } 15064 { 15065 var x int32 = -1 15066 var y int32 = -1 15067 if !(x == y) { 15068 t.Errorf("!(%d == %d)", x, y) 15069 } 15070 if x != y { 15071 t.Errorf("%d != %d", x, y) 15072 } 15073 if x < y { 15074 t.Errorf("%d < %d", x, y) 15075 } 15076 if x > y { 15077 t.Errorf("%d > %d", x, y) 15078 } 15079 if !(x <= y) { 15080 t.Errorf("!(%d <= %d)", x, y) 15081 } 15082 if !(x >= y) { 15083 t.Errorf("!(%d >= %d)", x, y) 15084 } 15085 } 15086 { 15087 var x int32 = -1 15088 var y int32 = 0 15089 if x == y { 15090 t.Errorf("%d == %d", x, y) 15091 } 15092 if !(x != y) { 15093 t.Errorf("!(%d != %d)", x, y) 15094 } 15095 if !(x < y) { 15096 t.Errorf("!(%d < %d)", x, y) 15097 } 15098 if x > y { 15099 t.Errorf("%d > %d", x, y) 15100 } 15101 if !(x <= y) { 15102 t.Errorf("!(%d <= %d)", x, y) 15103 } 15104 if x >= y { 15105 t.Errorf("%d >= %d", x, y) 15106 } 15107 } 15108 { 15109 var x int32 = -1 15110 var y int32 = 1 15111 if x == y { 15112 t.Errorf("%d == %d", x, y) 15113 } 15114 if !(x != y) { 15115 t.Errorf("!(%d != %d)", x, y) 15116 } 15117 if !(x < y) { 15118 t.Errorf("!(%d < %d)", x, y) 15119 } 15120 if x > y { 15121 t.Errorf("%d > %d", x, y) 15122 } 15123 if !(x <= y) { 15124 t.Errorf("!(%d <= %d)", x, y) 15125 } 15126 if x >= y { 15127 t.Errorf("%d >= %d", x, y) 15128 } 15129 } 15130 { 15131 var x int32 = -1 15132 var y int32 = 2147483647 15133 if x == y { 15134 t.Errorf("%d == %d", x, y) 15135 } 15136 if !(x != y) { 15137 t.Errorf("!(%d != %d)", x, y) 15138 } 15139 if !(x < y) { 15140 t.Errorf("!(%d < %d)", x, y) 15141 } 15142 if x > y { 15143 t.Errorf("%d > %d", x, y) 15144 } 15145 if !(x <= y) { 15146 t.Errorf("!(%d <= %d)", x, y) 15147 } 15148 if x >= y { 15149 t.Errorf("%d >= %d", x, y) 15150 } 15151 } 15152 { 15153 var x int32 = 0 15154 var y int32 = -2147483648 15155 if x == y { 15156 t.Errorf("%d == %d", x, y) 15157 } 15158 if !(x != y) { 15159 t.Errorf("!(%d != %d)", x, y) 15160 } 15161 if x < y { 15162 t.Errorf("%d < %d", x, y) 15163 } 15164 if !(x > y) { 15165 t.Errorf("!(%d > %d)", x, y) 15166 } 15167 if x <= y { 15168 t.Errorf("%d <= %d", x, y) 15169 } 15170 if !(x >= y) { 15171 t.Errorf("!(%d >= %d)", x, y) 15172 } 15173 } 15174 { 15175 var x int32 = 0 15176 var y int32 = -2147483647 15177 if x == y { 15178 t.Errorf("%d == %d", x, y) 15179 } 15180 if !(x != y) { 15181 t.Errorf("!(%d != %d)", x, y) 15182 } 15183 if x < y { 15184 t.Errorf("%d < %d", x, y) 15185 } 15186 if !(x > y) { 15187 t.Errorf("!(%d > %d)", x, y) 15188 } 15189 if x <= y { 15190 t.Errorf("%d <= %d", x, y) 15191 } 15192 if !(x >= y) { 15193 t.Errorf("!(%d >= %d)", x, y) 15194 } 15195 } 15196 { 15197 var x int32 = 0 15198 var y int32 = -1 15199 if x == y { 15200 t.Errorf("%d == %d", x, y) 15201 } 15202 if !(x != y) { 15203 t.Errorf("!(%d != %d)", x, y) 15204 } 15205 if x < y { 15206 t.Errorf("%d < %d", x, y) 15207 } 15208 if !(x > y) { 15209 t.Errorf("!(%d > %d)", x, y) 15210 } 15211 if x <= y { 15212 t.Errorf("%d <= %d", x, y) 15213 } 15214 if !(x >= y) { 15215 t.Errorf("!(%d >= %d)", x, y) 15216 } 15217 } 15218 { 15219 var x int32 = 0 15220 var y int32 = 0 15221 if !(x == y) { 15222 t.Errorf("!(%d == %d)", x, y) 15223 } 15224 if x != y { 15225 t.Errorf("%d != %d", x, y) 15226 } 15227 if x < y { 15228 t.Errorf("%d < %d", x, y) 15229 } 15230 if x > y { 15231 t.Errorf("%d > %d", x, y) 15232 } 15233 if !(x <= y) { 15234 t.Errorf("!(%d <= %d)", x, y) 15235 } 15236 if !(x >= y) { 15237 t.Errorf("!(%d >= %d)", x, y) 15238 } 15239 } 15240 { 15241 var x int32 = 0 15242 var y int32 = 1 15243 if x == y { 15244 t.Errorf("%d == %d", x, y) 15245 } 15246 if !(x != y) { 15247 t.Errorf("!(%d != %d)", x, y) 15248 } 15249 if !(x < y) { 15250 t.Errorf("!(%d < %d)", x, y) 15251 } 15252 if x > y { 15253 t.Errorf("%d > %d", x, y) 15254 } 15255 if !(x <= y) { 15256 t.Errorf("!(%d <= %d)", x, y) 15257 } 15258 if x >= y { 15259 t.Errorf("%d >= %d", x, y) 15260 } 15261 } 15262 { 15263 var x int32 = 0 15264 var y int32 = 2147483647 15265 if x == y { 15266 t.Errorf("%d == %d", x, y) 15267 } 15268 if !(x != y) { 15269 t.Errorf("!(%d != %d)", x, y) 15270 } 15271 if !(x < y) { 15272 t.Errorf("!(%d < %d)", x, y) 15273 } 15274 if x > y { 15275 t.Errorf("%d > %d", x, y) 15276 } 15277 if !(x <= y) { 15278 t.Errorf("!(%d <= %d)", x, y) 15279 } 15280 if x >= y { 15281 t.Errorf("%d >= %d", x, y) 15282 } 15283 } 15284 { 15285 var x int32 = 1 15286 var y int32 = -2147483648 15287 if x == y { 15288 t.Errorf("%d == %d", x, y) 15289 } 15290 if !(x != y) { 15291 t.Errorf("!(%d != %d)", x, y) 15292 } 15293 if x < y { 15294 t.Errorf("%d < %d", x, y) 15295 } 15296 if !(x > y) { 15297 t.Errorf("!(%d > %d)", x, y) 15298 } 15299 if x <= y { 15300 t.Errorf("%d <= %d", x, y) 15301 } 15302 if !(x >= y) { 15303 t.Errorf("!(%d >= %d)", x, y) 15304 } 15305 } 15306 { 15307 var x int32 = 1 15308 var y int32 = -2147483647 15309 if x == y { 15310 t.Errorf("%d == %d", x, y) 15311 } 15312 if !(x != y) { 15313 t.Errorf("!(%d != %d)", x, y) 15314 } 15315 if x < y { 15316 t.Errorf("%d < %d", x, y) 15317 } 15318 if !(x > y) { 15319 t.Errorf("!(%d > %d)", x, y) 15320 } 15321 if x <= y { 15322 t.Errorf("%d <= %d", x, y) 15323 } 15324 if !(x >= y) { 15325 t.Errorf("!(%d >= %d)", x, y) 15326 } 15327 } 15328 { 15329 var x int32 = 1 15330 var y int32 = -1 15331 if x == y { 15332 t.Errorf("%d == %d", x, y) 15333 } 15334 if !(x != y) { 15335 t.Errorf("!(%d != %d)", x, y) 15336 } 15337 if x < y { 15338 t.Errorf("%d < %d", x, y) 15339 } 15340 if !(x > y) { 15341 t.Errorf("!(%d > %d)", x, y) 15342 } 15343 if x <= y { 15344 t.Errorf("%d <= %d", x, y) 15345 } 15346 if !(x >= y) { 15347 t.Errorf("!(%d >= %d)", x, y) 15348 } 15349 } 15350 { 15351 var x int32 = 1 15352 var y int32 = 0 15353 if x == y { 15354 t.Errorf("%d == %d", x, y) 15355 } 15356 if !(x != y) { 15357 t.Errorf("!(%d != %d)", x, y) 15358 } 15359 if x < y { 15360 t.Errorf("%d < %d", x, y) 15361 } 15362 if !(x > y) { 15363 t.Errorf("!(%d > %d)", x, y) 15364 } 15365 if x <= y { 15366 t.Errorf("%d <= %d", x, y) 15367 } 15368 if !(x >= y) { 15369 t.Errorf("!(%d >= %d)", x, y) 15370 } 15371 } 15372 { 15373 var x int32 = 1 15374 var y int32 = 1 15375 if !(x == y) { 15376 t.Errorf("!(%d == %d)", x, y) 15377 } 15378 if x != y { 15379 t.Errorf("%d != %d", x, y) 15380 } 15381 if x < y { 15382 t.Errorf("%d < %d", x, y) 15383 } 15384 if x > y { 15385 t.Errorf("%d > %d", x, y) 15386 } 15387 if !(x <= y) { 15388 t.Errorf("!(%d <= %d)", x, y) 15389 } 15390 if !(x >= y) { 15391 t.Errorf("!(%d >= %d)", x, y) 15392 } 15393 } 15394 { 15395 var x int32 = 1 15396 var y int32 = 2147483647 15397 if x == y { 15398 t.Errorf("%d == %d", x, y) 15399 } 15400 if !(x != y) { 15401 t.Errorf("!(%d != %d)", x, y) 15402 } 15403 if !(x < y) { 15404 t.Errorf("!(%d < %d)", x, y) 15405 } 15406 if x > y { 15407 t.Errorf("%d > %d", x, y) 15408 } 15409 if !(x <= y) { 15410 t.Errorf("!(%d <= %d)", x, y) 15411 } 15412 if x >= y { 15413 t.Errorf("%d >= %d", x, y) 15414 } 15415 } 15416 { 15417 var x int32 = 2147483647 15418 var y int32 = -2147483648 15419 if x == y { 15420 t.Errorf("%d == %d", x, y) 15421 } 15422 if !(x != y) { 15423 t.Errorf("!(%d != %d)", x, y) 15424 } 15425 if x < y { 15426 t.Errorf("%d < %d", x, y) 15427 } 15428 if !(x > y) { 15429 t.Errorf("!(%d > %d)", x, y) 15430 } 15431 if x <= y { 15432 t.Errorf("%d <= %d", x, y) 15433 } 15434 if !(x >= y) { 15435 t.Errorf("!(%d >= %d)", x, y) 15436 } 15437 } 15438 { 15439 var x int32 = 2147483647 15440 var y int32 = -2147483647 15441 if x == y { 15442 t.Errorf("%d == %d", x, y) 15443 } 15444 if !(x != y) { 15445 t.Errorf("!(%d != %d)", x, y) 15446 } 15447 if x < y { 15448 t.Errorf("%d < %d", x, y) 15449 } 15450 if !(x > y) { 15451 t.Errorf("!(%d > %d)", x, y) 15452 } 15453 if x <= y { 15454 t.Errorf("%d <= %d", x, y) 15455 } 15456 if !(x >= y) { 15457 t.Errorf("!(%d >= %d)", x, y) 15458 } 15459 } 15460 { 15461 var x int32 = 2147483647 15462 var y int32 = -1 15463 if x == y { 15464 t.Errorf("%d == %d", x, y) 15465 } 15466 if !(x != y) { 15467 t.Errorf("!(%d != %d)", x, y) 15468 } 15469 if x < y { 15470 t.Errorf("%d < %d", x, y) 15471 } 15472 if !(x > y) { 15473 t.Errorf("!(%d > %d)", x, y) 15474 } 15475 if x <= y { 15476 t.Errorf("%d <= %d", x, y) 15477 } 15478 if !(x >= y) { 15479 t.Errorf("!(%d >= %d)", x, y) 15480 } 15481 } 15482 { 15483 var x int32 = 2147483647 15484 var y int32 = 0 15485 if x == y { 15486 t.Errorf("%d == %d", x, y) 15487 } 15488 if !(x != y) { 15489 t.Errorf("!(%d != %d)", x, y) 15490 } 15491 if x < y { 15492 t.Errorf("%d < %d", x, y) 15493 } 15494 if !(x > y) { 15495 t.Errorf("!(%d > %d)", x, y) 15496 } 15497 if x <= y { 15498 t.Errorf("%d <= %d", x, y) 15499 } 15500 if !(x >= y) { 15501 t.Errorf("!(%d >= %d)", x, y) 15502 } 15503 } 15504 { 15505 var x int32 = 2147483647 15506 var y int32 = 1 15507 if x == y { 15508 t.Errorf("%d == %d", x, y) 15509 } 15510 if !(x != y) { 15511 t.Errorf("!(%d != %d)", x, y) 15512 } 15513 if x < y { 15514 t.Errorf("%d < %d", x, y) 15515 } 15516 if !(x > y) { 15517 t.Errorf("!(%d > %d)", x, y) 15518 } 15519 if x <= y { 15520 t.Errorf("%d <= %d", x, y) 15521 } 15522 if !(x >= y) { 15523 t.Errorf("!(%d >= %d)", x, y) 15524 } 15525 } 15526 { 15527 var x int32 = 2147483647 15528 var y int32 = 2147483647 15529 if !(x == y) { 15530 t.Errorf("!(%d == %d)", x, y) 15531 } 15532 if x != y { 15533 t.Errorf("%d != %d", x, y) 15534 } 15535 if x < y { 15536 t.Errorf("%d < %d", x, y) 15537 } 15538 if x > y { 15539 t.Errorf("%d > %d", x, y) 15540 } 15541 if !(x <= y) { 15542 t.Errorf("!(%d <= %d)", x, y) 15543 } 15544 if !(x >= y) { 15545 t.Errorf("!(%d >= %d)", x, y) 15546 } 15547 } 15548 } 15549 func TestConstFoldCompareuint16(t *testing.T) { 15550 { 15551 var x uint16 = 0 15552 var y uint16 = 0 15553 if !(x == y) { 15554 t.Errorf("!(%d == %d)", x, y) 15555 } 15556 if x != y { 15557 t.Errorf("%d != %d", x, y) 15558 } 15559 if x < y { 15560 t.Errorf("%d < %d", x, y) 15561 } 15562 if x > y { 15563 t.Errorf("%d > %d", x, y) 15564 } 15565 if !(x <= y) { 15566 t.Errorf("!(%d <= %d)", x, y) 15567 } 15568 if !(x >= y) { 15569 t.Errorf("!(%d >= %d)", x, y) 15570 } 15571 } 15572 { 15573 var x uint16 = 0 15574 var y uint16 = 1 15575 if x == y { 15576 t.Errorf("%d == %d", x, y) 15577 } 15578 if !(x != y) { 15579 t.Errorf("!(%d != %d)", x, y) 15580 } 15581 if !(x < y) { 15582 t.Errorf("!(%d < %d)", x, y) 15583 } 15584 if x > y { 15585 t.Errorf("%d > %d", x, y) 15586 } 15587 if !(x <= y) { 15588 t.Errorf("!(%d <= %d)", x, y) 15589 } 15590 if x >= y { 15591 t.Errorf("%d >= %d", x, y) 15592 } 15593 } 15594 { 15595 var x uint16 = 0 15596 var y uint16 = 65535 15597 if x == y { 15598 t.Errorf("%d == %d", x, y) 15599 } 15600 if !(x != y) { 15601 t.Errorf("!(%d != %d)", x, y) 15602 } 15603 if !(x < y) { 15604 t.Errorf("!(%d < %d)", x, y) 15605 } 15606 if x > y { 15607 t.Errorf("%d > %d", x, y) 15608 } 15609 if !(x <= y) { 15610 t.Errorf("!(%d <= %d)", x, y) 15611 } 15612 if x >= y { 15613 t.Errorf("%d >= %d", x, y) 15614 } 15615 } 15616 { 15617 var x uint16 = 1 15618 var y uint16 = 0 15619 if x == y { 15620 t.Errorf("%d == %d", x, y) 15621 } 15622 if !(x != y) { 15623 t.Errorf("!(%d != %d)", x, y) 15624 } 15625 if x < y { 15626 t.Errorf("%d < %d", x, y) 15627 } 15628 if !(x > y) { 15629 t.Errorf("!(%d > %d)", x, y) 15630 } 15631 if x <= y { 15632 t.Errorf("%d <= %d", x, y) 15633 } 15634 if !(x >= y) { 15635 t.Errorf("!(%d >= %d)", x, y) 15636 } 15637 } 15638 { 15639 var x uint16 = 1 15640 var y uint16 = 1 15641 if !(x == y) { 15642 t.Errorf("!(%d == %d)", x, y) 15643 } 15644 if x != y { 15645 t.Errorf("%d != %d", x, y) 15646 } 15647 if x < y { 15648 t.Errorf("%d < %d", x, y) 15649 } 15650 if x > y { 15651 t.Errorf("%d > %d", x, y) 15652 } 15653 if !(x <= y) { 15654 t.Errorf("!(%d <= %d)", x, y) 15655 } 15656 if !(x >= y) { 15657 t.Errorf("!(%d >= %d)", x, y) 15658 } 15659 } 15660 { 15661 var x uint16 = 1 15662 var y uint16 = 65535 15663 if x == y { 15664 t.Errorf("%d == %d", x, y) 15665 } 15666 if !(x != y) { 15667 t.Errorf("!(%d != %d)", x, y) 15668 } 15669 if !(x < y) { 15670 t.Errorf("!(%d < %d)", x, y) 15671 } 15672 if x > y { 15673 t.Errorf("%d > %d", x, y) 15674 } 15675 if !(x <= y) { 15676 t.Errorf("!(%d <= %d)", x, y) 15677 } 15678 if x >= y { 15679 t.Errorf("%d >= %d", x, y) 15680 } 15681 } 15682 { 15683 var x uint16 = 65535 15684 var y uint16 = 0 15685 if x == y { 15686 t.Errorf("%d == %d", x, y) 15687 } 15688 if !(x != y) { 15689 t.Errorf("!(%d != %d)", x, y) 15690 } 15691 if x < y { 15692 t.Errorf("%d < %d", x, y) 15693 } 15694 if !(x > y) { 15695 t.Errorf("!(%d > %d)", x, y) 15696 } 15697 if x <= y { 15698 t.Errorf("%d <= %d", x, y) 15699 } 15700 if !(x >= y) { 15701 t.Errorf("!(%d >= %d)", x, y) 15702 } 15703 } 15704 { 15705 var x uint16 = 65535 15706 var y uint16 = 1 15707 if x == y { 15708 t.Errorf("%d == %d", x, y) 15709 } 15710 if !(x != y) { 15711 t.Errorf("!(%d != %d)", x, y) 15712 } 15713 if x < y { 15714 t.Errorf("%d < %d", x, y) 15715 } 15716 if !(x > y) { 15717 t.Errorf("!(%d > %d)", x, y) 15718 } 15719 if x <= y { 15720 t.Errorf("%d <= %d", x, y) 15721 } 15722 if !(x >= y) { 15723 t.Errorf("!(%d >= %d)", x, y) 15724 } 15725 } 15726 { 15727 var x uint16 = 65535 15728 var y uint16 = 65535 15729 if !(x == y) { 15730 t.Errorf("!(%d == %d)", x, y) 15731 } 15732 if x != y { 15733 t.Errorf("%d != %d", x, y) 15734 } 15735 if x < y { 15736 t.Errorf("%d < %d", x, y) 15737 } 15738 if x > y { 15739 t.Errorf("%d > %d", x, y) 15740 } 15741 if !(x <= y) { 15742 t.Errorf("!(%d <= %d)", x, y) 15743 } 15744 if !(x >= y) { 15745 t.Errorf("!(%d >= %d)", x, y) 15746 } 15747 } 15748 } 15749 func TestConstFoldCompareint16(t *testing.T) { 15750 { 15751 var x int16 = -32768 15752 var y int16 = -32768 15753 if !(x == y) { 15754 t.Errorf("!(%d == %d)", x, y) 15755 } 15756 if x != y { 15757 t.Errorf("%d != %d", x, y) 15758 } 15759 if x < y { 15760 t.Errorf("%d < %d", x, y) 15761 } 15762 if x > y { 15763 t.Errorf("%d > %d", x, y) 15764 } 15765 if !(x <= y) { 15766 t.Errorf("!(%d <= %d)", x, y) 15767 } 15768 if !(x >= y) { 15769 t.Errorf("!(%d >= %d)", x, y) 15770 } 15771 } 15772 { 15773 var x int16 = -32768 15774 var y int16 = -32767 15775 if x == y { 15776 t.Errorf("%d == %d", x, y) 15777 } 15778 if !(x != y) { 15779 t.Errorf("!(%d != %d)", x, y) 15780 } 15781 if !(x < y) { 15782 t.Errorf("!(%d < %d)", x, y) 15783 } 15784 if x > y { 15785 t.Errorf("%d > %d", x, y) 15786 } 15787 if !(x <= y) { 15788 t.Errorf("!(%d <= %d)", x, y) 15789 } 15790 if x >= y { 15791 t.Errorf("%d >= %d", x, y) 15792 } 15793 } 15794 { 15795 var x int16 = -32768 15796 var y int16 = -1 15797 if x == y { 15798 t.Errorf("%d == %d", x, y) 15799 } 15800 if !(x != y) { 15801 t.Errorf("!(%d != %d)", x, y) 15802 } 15803 if !(x < y) { 15804 t.Errorf("!(%d < %d)", x, y) 15805 } 15806 if x > y { 15807 t.Errorf("%d > %d", x, y) 15808 } 15809 if !(x <= y) { 15810 t.Errorf("!(%d <= %d)", x, y) 15811 } 15812 if x >= y { 15813 t.Errorf("%d >= %d", x, y) 15814 } 15815 } 15816 { 15817 var x int16 = -32768 15818 var y int16 = 0 15819 if x == y { 15820 t.Errorf("%d == %d", x, y) 15821 } 15822 if !(x != y) { 15823 t.Errorf("!(%d != %d)", x, y) 15824 } 15825 if !(x < y) { 15826 t.Errorf("!(%d < %d)", x, y) 15827 } 15828 if x > y { 15829 t.Errorf("%d > %d", x, y) 15830 } 15831 if !(x <= y) { 15832 t.Errorf("!(%d <= %d)", x, y) 15833 } 15834 if x >= y { 15835 t.Errorf("%d >= %d", x, y) 15836 } 15837 } 15838 { 15839 var x int16 = -32768 15840 var y int16 = 1 15841 if x == y { 15842 t.Errorf("%d == %d", x, y) 15843 } 15844 if !(x != y) { 15845 t.Errorf("!(%d != %d)", x, y) 15846 } 15847 if !(x < y) { 15848 t.Errorf("!(%d < %d)", x, y) 15849 } 15850 if x > y { 15851 t.Errorf("%d > %d", x, y) 15852 } 15853 if !(x <= y) { 15854 t.Errorf("!(%d <= %d)", x, y) 15855 } 15856 if x >= y { 15857 t.Errorf("%d >= %d", x, y) 15858 } 15859 } 15860 { 15861 var x int16 = -32768 15862 var y int16 = 32766 15863 if x == y { 15864 t.Errorf("%d == %d", x, y) 15865 } 15866 if !(x != y) { 15867 t.Errorf("!(%d != %d)", x, y) 15868 } 15869 if !(x < y) { 15870 t.Errorf("!(%d < %d)", x, y) 15871 } 15872 if x > y { 15873 t.Errorf("%d > %d", x, y) 15874 } 15875 if !(x <= y) { 15876 t.Errorf("!(%d <= %d)", x, y) 15877 } 15878 if x >= y { 15879 t.Errorf("%d >= %d", x, y) 15880 } 15881 } 15882 { 15883 var x int16 = -32768 15884 var y int16 = 32767 15885 if x == y { 15886 t.Errorf("%d == %d", x, y) 15887 } 15888 if !(x != y) { 15889 t.Errorf("!(%d != %d)", x, y) 15890 } 15891 if !(x < y) { 15892 t.Errorf("!(%d < %d)", x, y) 15893 } 15894 if x > y { 15895 t.Errorf("%d > %d", x, y) 15896 } 15897 if !(x <= y) { 15898 t.Errorf("!(%d <= %d)", x, y) 15899 } 15900 if x >= y { 15901 t.Errorf("%d >= %d", x, y) 15902 } 15903 } 15904 { 15905 var x int16 = -32767 15906 var y int16 = -32768 15907 if x == y { 15908 t.Errorf("%d == %d", x, y) 15909 } 15910 if !(x != y) { 15911 t.Errorf("!(%d != %d)", x, y) 15912 } 15913 if x < y { 15914 t.Errorf("%d < %d", x, y) 15915 } 15916 if !(x > y) { 15917 t.Errorf("!(%d > %d)", x, y) 15918 } 15919 if x <= y { 15920 t.Errorf("%d <= %d", x, y) 15921 } 15922 if !(x >= y) { 15923 t.Errorf("!(%d >= %d)", x, y) 15924 } 15925 } 15926 { 15927 var x int16 = -32767 15928 var y int16 = -32767 15929 if !(x == y) { 15930 t.Errorf("!(%d == %d)", x, y) 15931 } 15932 if x != y { 15933 t.Errorf("%d != %d", x, y) 15934 } 15935 if x < y { 15936 t.Errorf("%d < %d", x, y) 15937 } 15938 if x > y { 15939 t.Errorf("%d > %d", x, y) 15940 } 15941 if !(x <= y) { 15942 t.Errorf("!(%d <= %d)", x, y) 15943 } 15944 if !(x >= y) { 15945 t.Errorf("!(%d >= %d)", x, y) 15946 } 15947 } 15948 { 15949 var x int16 = -32767 15950 var y int16 = -1 15951 if x == y { 15952 t.Errorf("%d == %d", x, y) 15953 } 15954 if !(x != y) { 15955 t.Errorf("!(%d != %d)", x, y) 15956 } 15957 if !(x < y) { 15958 t.Errorf("!(%d < %d)", x, y) 15959 } 15960 if x > y { 15961 t.Errorf("%d > %d", x, y) 15962 } 15963 if !(x <= y) { 15964 t.Errorf("!(%d <= %d)", x, y) 15965 } 15966 if x >= y { 15967 t.Errorf("%d >= %d", x, y) 15968 } 15969 } 15970 { 15971 var x int16 = -32767 15972 var y int16 = 0 15973 if x == y { 15974 t.Errorf("%d == %d", x, y) 15975 } 15976 if !(x != y) { 15977 t.Errorf("!(%d != %d)", x, y) 15978 } 15979 if !(x < y) { 15980 t.Errorf("!(%d < %d)", x, y) 15981 } 15982 if x > y { 15983 t.Errorf("%d > %d", x, y) 15984 } 15985 if !(x <= y) { 15986 t.Errorf("!(%d <= %d)", x, y) 15987 } 15988 if x >= y { 15989 t.Errorf("%d >= %d", x, y) 15990 } 15991 } 15992 { 15993 var x int16 = -32767 15994 var y int16 = 1 15995 if x == y { 15996 t.Errorf("%d == %d", x, y) 15997 } 15998 if !(x != y) { 15999 t.Errorf("!(%d != %d)", x, y) 16000 } 16001 if !(x < y) { 16002 t.Errorf("!(%d < %d)", x, y) 16003 } 16004 if x > y { 16005 t.Errorf("%d > %d", x, y) 16006 } 16007 if !(x <= y) { 16008 t.Errorf("!(%d <= %d)", x, y) 16009 } 16010 if x >= y { 16011 t.Errorf("%d >= %d", x, y) 16012 } 16013 } 16014 { 16015 var x int16 = -32767 16016 var y int16 = 32766 16017 if x == y { 16018 t.Errorf("%d == %d", x, y) 16019 } 16020 if !(x != y) { 16021 t.Errorf("!(%d != %d)", x, y) 16022 } 16023 if !(x < y) { 16024 t.Errorf("!(%d < %d)", x, y) 16025 } 16026 if x > y { 16027 t.Errorf("%d > %d", x, y) 16028 } 16029 if !(x <= y) { 16030 t.Errorf("!(%d <= %d)", x, y) 16031 } 16032 if x >= y { 16033 t.Errorf("%d >= %d", x, y) 16034 } 16035 } 16036 { 16037 var x int16 = -32767 16038 var y int16 = 32767 16039 if x == y { 16040 t.Errorf("%d == %d", x, y) 16041 } 16042 if !(x != y) { 16043 t.Errorf("!(%d != %d)", x, y) 16044 } 16045 if !(x < y) { 16046 t.Errorf("!(%d < %d)", x, y) 16047 } 16048 if x > y { 16049 t.Errorf("%d > %d", x, y) 16050 } 16051 if !(x <= y) { 16052 t.Errorf("!(%d <= %d)", x, y) 16053 } 16054 if x >= y { 16055 t.Errorf("%d >= %d", x, y) 16056 } 16057 } 16058 { 16059 var x int16 = -1 16060 var y int16 = -32768 16061 if x == y { 16062 t.Errorf("%d == %d", x, y) 16063 } 16064 if !(x != y) { 16065 t.Errorf("!(%d != %d)", x, y) 16066 } 16067 if x < y { 16068 t.Errorf("%d < %d", x, y) 16069 } 16070 if !(x > y) { 16071 t.Errorf("!(%d > %d)", x, y) 16072 } 16073 if x <= y { 16074 t.Errorf("%d <= %d", x, y) 16075 } 16076 if !(x >= y) { 16077 t.Errorf("!(%d >= %d)", x, y) 16078 } 16079 } 16080 { 16081 var x int16 = -1 16082 var y int16 = -32767 16083 if x == y { 16084 t.Errorf("%d == %d", x, y) 16085 } 16086 if !(x != y) { 16087 t.Errorf("!(%d != %d)", x, y) 16088 } 16089 if x < y { 16090 t.Errorf("%d < %d", x, y) 16091 } 16092 if !(x > y) { 16093 t.Errorf("!(%d > %d)", x, y) 16094 } 16095 if x <= y { 16096 t.Errorf("%d <= %d", x, y) 16097 } 16098 if !(x >= y) { 16099 t.Errorf("!(%d >= %d)", x, y) 16100 } 16101 } 16102 { 16103 var x int16 = -1 16104 var y int16 = -1 16105 if !(x == y) { 16106 t.Errorf("!(%d == %d)", x, y) 16107 } 16108 if x != y { 16109 t.Errorf("%d != %d", x, y) 16110 } 16111 if x < y { 16112 t.Errorf("%d < %d", x, y) 16113 } 16114 if x > y { 16115 t.Errorf("%d > %d", x, y) 16116 } 16117 if !(x <= y) { 16118 t.Errorf("!(%d <= %d)", x, y) 16119 } 16120 if !(x >= y) { 16121 t.Errorf("!(%d >= %d)", x, y) 16122 } 16123 } 16124 { 16125 var x int16 = -1 16126 var y int16 = 0 16127 if x == y { 16128 t.Errorf("%d == %d", x, y) 16129 } 16130 if !(x != y) { 16131 t.Errorf("!(%d != %d)", x, y) 16132 } 16133 if !(x < y) { 16134 t.Errorf("!(%d < %d)", x, y) 16135 } 16136 if x > y { 16137 t.Errorf("%d > %d", x, y) 16138 } 16139 if !(x <= y) { 16140 t.Errorf("!(%d <= %d)", x, y) 16141 } 16142 if x >= y { 16143 t.Errorf("%d >= %d", x, y) 16144 } 16145 } 16146 { 16147 var x int16 = -1 16148 var y int16 = 1 16149 if x == y { 16150 t.Errorf("%d == %d", x, y) 16151 } 16152 if !(x != y) { 16153 t.Errorf("!(%d != %d)", x, y) 16154 } 16155 if !(x < y) { 16156 t.Errorf("!(%d < %d)", x, y) 16157 } 16158 if x > y { 16159 t.Errorf("%d > %d", x, y) 16160 } 16161 if !(x <= y) { 16162 t.Errorf("!(%d <= %d)", x, y) 16163 } 16164 if x >= y { 16165 t.Errorf("%d >= %d", x, y) 16166 } 16167 } 16168 { 16169 var x int16 = -1 16170 var y int16 = 32766 16171 if x == y { 16172 t.Errorf("%d == %d", x, y) 16173 } 16174 if !(x != y) { 16175 t.Errorf("!(%d != %d)", x, y) 16176 } 16177 if !(x < y) { 16178 t.Errorf("!(%d < %d)", x, y) 16179 } 16180 if x > y { 16181 t.Errorf("%d > %d", x, y) 16182 } 16183 if !(x <= y) { 16184 t.Errorf("!(%d <= %d)", x, y) 16185 } 16186 if x >= y { 16187 t.Errorf("%d >= %d", x, y) 16188 } 16189 } 16190 { 16191 var x int16 = -1 16192 var y int16 = 32767 16193 if x == y { 16194 t.Errorf("%d == %d", x, y) 16195 } 16196 if !(x != y) { 16197 t.Errorf("!(%d != %d)", x, y) 16198 } 16199 if !(x < y) { 16200 t.Errorf("!(%d < %d)", x, y) 16201 } 16202 if x > y { 16203 t.Errorf("%d > %d", x, y) 16204 } 16205 if !(x <= y) { 16206 t.Errorf("!(%d <= %d)", x, y) 16207 } 16208 if x >= y { 16209 t.Errorf("%d >= %d", x, y) 16210 } 16211 } 16212 { 16213 var x int16 = 0 16214 var y int16 = -32768 16215 if x == y { 16216 t.Errorf("%d == %d", x, y) 16217 } 16218 if !(x != y) { 16219 t.Errorf("!(%d != %d)", x, y) 16220 } 16221 if x < y { 16222 t.Errorf("%d < %d", x, y) 16223 } 16224 if !(x > y) { 16225 t.Errorf("!(%d > %d)", x, y) 16226 } 16227 if x <= y { 16228 t.Errorf("%d <= %d", x, y) 16229 } 16230 if !(x >= y) { 16231 t.Errorf("!(%d >= %d)", x, y) 16232 } 16233 } 16234 { 16235 var x int16 = 0 16236 var y int16 = -32767 16237 if x == y { 16238 t.Errorf("%d == %d", x, y) 16239 } 16240 if !(x != y) { 16241 t.Errorf("!(%d != %d)", x, y) 16242 } 16243 if x < y { 16244 t.Errorf("%d < %d", x, y) 16245 } 16246 if !(x > y) { 16247 t.Errorf("!(%d > %d)", x, y) 16248 } 16249 if x <= y { 16250 t.Errorf("%d <= %d", x, y) 16251 } 16252 if !(x >= y) { 16253 t.Errorf("!(%d >= %d)", x, y) 16254 } 16255 } 16256 { 16257 var x int16 = 0 16258 var y int16 = -1 16259 if x == y { 16260 t.Errorf("%d == %d", x, y) 16261 } 16262 if !(x != y) { 16263 t.Errorf("!(%d != %d)", x, y) 16264 } 16265 if x < y { 16266 t.Errorf("%d < %d", x, y) 16267 } 16268 if !(x > y) { 16269 t.Errorf("!(%d > %d)", x, y) 16270 } 16271 if x <= y { 16272 t.Errorf("%d <= %d", x, y) 16273 } 16274 if !(x >= y) { 16275 t.Errorf("!(%d >= %d)", x, y) 16276 } 16277 } 16278 { 16279 var x int16 = 0 16280 var y int16 = 0 16281 if !(x == y) { 16282 t.Errorf("!(%d == %d)", x, y) 16283 } 16284 if x != y { 16285 t.Errorf("%d != %d", x, y) 16286 } 16287 if x < y { 16288 t.Errorf("%d < %d", x, y) 16289 } 16290 if x > y { 16291 t.Errorf("%d > %d", x, y) 16292 } 16293 if !(x <= y) { 16294 t.Errorf("!(%d <= %d)", x, y) 16295 } 16296 if !(x >= y) { 16297 t.Errorf("!(%d >= %d)", x, y) 16298 } 16299 } 16300 { 16301 var x int16 = 0 16302 var y int16 = 1 16303 if x == y { 16304 t.Errorf("%d == %d", x, y) 16305 } 16306 if !(x != y) { 16307 t.Errorf("!(%d != %d)", x, y) 16308 } 16309 if !(x < y) { 16310 t.Errorf("!(%d < %d)", x, y) 16311 } 16312 if x > y { 16313 t.Errorf("%d > %d", x, y) 16314 } 16315 if !(x <= y) { 16316 t.Errorf("!(%d <= %d)", x, y) 16317 } 16318 if x >= y { 16319 t.Errorf("%d >= %d", x, y) 16320 } 16321 } 16322 { 16323 var x int16 = 0 16324 var y int16 = 32766 16325 if x == y { 16326 t.Errorf("%d == %d", x, y) 16327 } 16328 if !(x != y) { 16329 t.Errorf("!(%d != %d)", x, y) 16330 } 16331 if !(x < y) { 16332 t.Errorf("!(%d < %d)", x, y) 16333 } 16334 if x > y { 16335 t.Errorf("%d > %d", x, y) 16336 } 16337 if !(x <= y) { 16338 t.Errorf("!(%d <= %d)", x, y) 16339 } 16340 if x >= y { 16341 t.Errorf("%d >= %d", x, y) 16342 } 16343 } 16344 { 16345 var x int16 = 0 16346 var y int16 = 32767 16347 if x == y { 16348 t.Errorf("%d == %d", x, y) 16349 } 16350 if !(x != y) { 16351 t.Errorf("!(%d != %d)", x, y) 16352 } 16353 if !(x < y) { 16354 t.Errorf("!(%d < %d)", x, y) 16355 } 16356 if x > y { 16357 t.Errorf("%d > %d", x, y) 16358 } 16359 if !(x <= y) { 16360 t.Errorf("!(%d <= %d)", x, y) 16361 } 16362 if x >= y { 16363 t.Errorf("%d >= %d", x, y) 16364 } 16365 } 16366 { 16367 var x int16 = 1 16368 var y int16 = -32768 16369 if x == y { 16370 t.Errorf("%d == %d", x, y) 16371 } 16372 if !(x != y) { 16373 t.Errorf("!(%d != %d)", x, y) 16374 } 16375 if x < y { 16376 t.Errorf("%d < %d", x, y) 16377 } 16378 if !(x > y) { 16379 t.Errorf("!(%d > %d)", x, y) 16380 } 16381 if x <= y { 16382 t.Errorf("%d <= %d", x, y) 16383 } 16384 if !(x >= y) { 16385 t.Errorf("!(%d >= %d)", x, y) 16386 } 16387 } 16388 { 16389 var x int16 = 1 16390 var y int16 = -32767 16391 if x == y { 16392 t.Errorf("%d == %d", x, y) 16393 } 16394 if !(x != y) { 16395 t.Errorf("!(%d != %d)", x, y) 16396 } 16397 if x < y { 16398 t.Errorf("%d < %d", x, y) 16399 } 16400 if !(x > y) { 16401 t.Errorf("!(%d > %d)", x, y) 16402 } 16403 if x <= y { 16404 t.Errorf("%d <= %d", x, y) 16405 } 16406 if !(x >= y) { 16407 t.Errorf("!(%d >= %d)", x, y) 16408 } 16409 } 16410 { 16411 var x int16 = 1 16412 var y int16 = -1 16413 if x == y { 16414 t.Errorf("%d == %d", x, y) 16415 } 16416 if !(x != y) { 16417 t.Errorf("!(%d != %d)", x, y) 16418 } 16419 if x < y { 16420 t.Errorf("%d < %d", x, y) 16421 } 16422 if !(x > y) { 16423 t.Errorf("!(%d > %d)", x, y) 16424 } 16425 if x <= y { 16426 t.Errorf("%d <= %d", x, y) 16427 } 16428 if !(x >= y) { 16429 t.Errorf("!(%d >= %d)", x, y) 16430 } 16431 } 16432 { 16433 var x int16 = 1 16434 var y int16 = 0 16435 if x == y { 16436 t.Errorf("%d == %d", x, y) 16437 } 16438 if !(x != y) { 16439 t.Errorf("!(%d != %d)", x, y) 16440 } 16441 if x < y { 16442 t.Errorf("%d < %d", x, y) 16443 } 16444 if !(x > y) { 16445 t.Errorf("!(%d > %d)", x, y) 16446 } 16447 if x <= y { 16448 t.Errorf("%d <= %d", x, y) 16449 } 16450 if !(x >= y) { 16451 t.Errorf("!(%d >= %d)", x, y) 16452 } 16453 } 16454 { 16455 var x int16 = 1 16456 var y int16 = 1 16457 if !(x == y) { 16458 t.Errorf("!(%d == %d)", x, y) 16459 } 16460 if x != y { 16461 t.Errorf("%d != %d", x, y) 16462 } 16463 if x < y { 16464 t.Errorf("%d < %d", x, y) 16465 } 16466 if x > y { 16467 t.Errorf("%d > %d", x, y) 16468 } 16469 if !(x <= y) { 16470 t.Errorf("!(%d <= %d)", x, y) 16471 } 16472 if !(x >= y) { 16473 t.Errorf("!(%d >= %d)", x, y) 16474 } 16475 } 16476 { 16477 var x int16 = 1 16478 var y int16 = 32766 16479 if x == y { 16480 t.Errorf("%d == %d", x, y) 16481 } 16482 if !(x != y) { 16483 t.Errorf("!(%d != %d)", x, y) 16484 } 16485 if !(x < y) { 16486 t.Errorf("!(%d < %d)", x, y) 16487 } 16488 if x > y { 16489 t.Errorf("%d > %d", x, y) 16490 } 16491 if !(x <= y) { 16492 t.Errorf("!(%d <= %d)", x, y) 16493 } 16494 if x >= y { 16495 t.Errorf("%d >= %d", x, y) 16496 } 16497 } 16498 { 16499 var x int16 = 1 16500 var y int16 = 32767 16501 if x == y { 16502 t.Errorf("%d == %d", x, y) 16503 } 16504 if !(x != y) { 16505 t.Errorf("!(%d != %d)", x, y) 16506 } 16507 if !(x < y) { 16508 t.Errorf("!(%d < %d)", x, y) 16509 } 16510 if x > y { 16511 t.Errorf("%d > %d", x, y) 16512 } 16513 if !(x <= y) { 16514 t.Errorf("!(%d <= %d)", x, y) 16515 } 16516 if x >= y { 16517 t.Errorf("%d >= %d", x, y) 16518 } 16519 } 16520 { 16521 var x int16 = 32766 16522 var y int16 = -32768 16523 if x == y { 16524 t.Errorf("%d == %d", x, y) 16525 } 16526 if !(x != y) { 16527 t.Errorf("!(%d != %d)", x, y) 16528 } 16529 if x < y { 16530 t.Errorf("%d < %d", x, y) 16531 } 16532 if !(x > y) { 16533 t.Errorf("!(%d > %d)", x, y) 16534 } 16535 if x <= y { 16536 t.Errorf("%d <= %d", x, y) 16537 } 16538 if !(x >= y) { 16539 t.Errorf("!(%d >= %d)", x, y) 16540 } 16541 } 16542 { 16543 var x int16 = 32766 16544 var y int16 = -32767 16545 if x == y { 16546 t.Errorf("%d == %d", x, y) 16547 } 16548 if !(x != y) { 16549 t.Errorf("!(%d != %d)", x, y) 16550 } 16551 if x < y { 16552 t.Errorf("%d < %d", x, y) 16553 } 16554 if !(x > y) { 16555 t.Errorf("!(%d > %d)", x, y) 16556 } 16557 if x <= y { 16558 t.Errorf("%d <= %d", x, y) 16559 } 16560 if !(x >= y) { 16561 t.Errorf("!(%d >= %d)", x, y) 16562 } 16563 } 16564 { 16565 var x int16 = 32766 16566 var y int16 = -1 16567 if x == y { 16568 t.Errorf("%d == %d", x, y) 16569 } 16570 if !(x != y) { 16571 t.Errorf("!(%d != %d)", x, y) 16572 } 16573 if x < y { 16574 t.Errorf("%d < %d", x, y) 16575 } 16576 if !(x > y) { 16577 t.Errorf("!(%d > %d)", x, y) 16578 } 16579 if x <= y { 16580 t.Errorf("%d <= %d", x, y) 16581 } 16582 if !(x >= y) { 16583 t.Errorf("!(%d >= %d)", x, y) 16584 } 16585 } 16586 { 16587 var x int16 = 32766 16588 var y int16 = 0 16589 if x == y { 16590 t.Errorf("%d == %d", x, y) 16591 } 16592 if !(x != y) { 16593 t.Errorf("!(%d != %d)", x, y) 16594 } 16595 if x < y { 16596 t.Errorf("%d < %d", x, y) 16597 } 16598 if !(x > y) { 16599 t.Errorf("!(%d > %d)", x, y) 16600 } 16601 if x <= y { 16602 t.Errorf("%d <= %d", x, y) 16603 } 16604 if !(x >= y) { 16605 t.Errorf("!(%d >= %d)", x, y) 16606 } 16607 } 16608 { 16609 var x int16 = 32766 16610 var y int16 = 1 16611 if x == y { 16612 t.Errorf("%d == %d", x, y) 16613 } 16614 if !(x != y) { 16615 t.Errorf("!(%d != %d)", x, y) 16616 } 16617 if x < y { 16618 t.Errorf("%d < %d", x, y) 16619 } 16620 if !(x > y) { 16621 t.Errorf("!(%d > %d)", x, y) 16622 } 16623 if x <= y { 16624 t.Errorf("%d <= %d", x, y) 16625 } 16626 if !(x >= y) { 16627 t.Errorf("!(%d >= %d)", x, y) 16628 } 16629 } 16630 { 16631 var x int16 = 32766 16632 var y int16 = 32766 16633 if !(x == y) { 16634 t.Errorf("!(%d == %d)", x, y) 16635 } 16636 if x != y { 16637 t.Errorf("%d != %d", x, y) 16638 } 16639 if x < y { 16640 t.Errorf("%d < %d", x, y) 16641 } 16642 if x > y { 16643 t.Errorf("%d > %d", x, y) 16644 } 16645 if !(x <= y) { 16646 t.Errorf("!(%d <= %d)", x, y) 16647 } 16648 if !(x >= y) { 16649 t.Errorf("!(%d >= %d)", x, y) 16650 } 16651 } 16652 { 16653 var x int16 = 32766 16654 var y int16 = 32767 16655 if x == y { 16656 t.Errorf("%d == %d", x, y) 16657 } 16658 if !(x != y) { 16659 t.Errorf("!(%d != %d)", x, y) 16660 } 16661 if !(x < y) { 16662 t.Errorf("!(%d < %d)", x, y) 16663 } 16664 if x > y { 16665 t.Errorf("%d > %d", x, y) 16666 } 16667 if !(x <= y) { 16668 t.Errorf("!(%d <= %d)", x, y) 16669 } 16670 if x >= y { 16671 t.Errorf("%d >= %d", x, y) 16672 } 16673 } 16674 { 16675 var x int16 = 32767 16676 var y int16 = -32768 16677 if x == y { 16678 t.Errorf("%d == %d", x, y) 16679 } 16680 if !(x != y) { 16681 t.Errorf("!(%d != %d)", x, y) 16682 } 16683 if x < y { 16684 t.Errorf("%d < %d", x, y) 16685 } 16686 if !(x > y) { 16687 t.Errorf("!(%d > %d)", x, y) 16688 } 16689 if x <= y { 16690 t.Errorf("%d <= %d", x, y) 16691 } 16692 if !(x >= y) { 16693 t.Errorf("!(%d >= %d)", x, y) 16694 } 16695 } 16696 { 16697 var x int16 = 32767 16698 var y int16 = -32767 16699 if x == y { 16700 t.Errorf("%d == %d", x, y) 16701 } 16702 if !(x != y) { 16703 t.Errorf("!(%d != %d)", x, y) 16704 } 16705 if x < y { 16706 t.Errorf("%d < %d", x, y) 16707 } 16708 if !(x > y) { 16709 t.Errorf("!(%d > %d)", x, y) 16710 } 16711 if x <= y { 16712 t.Errorf("%d <= %d", x, y) 16713 } 16714 if !(x >= y) { 16715 t.Errorf("!(%d >= %d)", x, y) 16716 } 16717 } 16718 { 16719 var x int16 = 32767 16720 var y int16 = -1 16721 if x == y { 16722 t.Errorf("%d == %d", x, y) 16723 } 16724 if !(x != y) { 16725 t.Errorf("!(%d != %d)", x, y) 16726 } 16727 if x < y { 16728 t.Errorf("%d < %d", x, y) 16729 } 16730 if !(x > y) { 16731 t.Errorf("!(%d > %d)", x, y) 16732 } 16733 if x <= y { 16734 t.Errorf("%d <= %d", x, y) 16735 } 16736 if !(x >= y) { 16737 t.Errorf("!(%d >= %d)", x, y) 16738 } 16739 } 16740 { 16741 var x int16 = 32767 16742 var y int16 = 0 16743 if x == y { 16744 t.Errorf("%d == %d", x, y) 16745 } 16746 if !(x != y) { 16747 t.Errorf("!(%d != %d)", x, y) 16748 } 16749 if x < y { 16750 t.Errorf("%d < %d", x, y) 16751 } 16752 if !(x > y) { 16753 t.Errorf("!(%d > %d)", x, y) 16754 } 16755 if x <= y { 16756 t.Errorf("%d <= %d", x, y) 16757 } 16758 if !(x >= y) { 16759 t.Errorf("!(%d >= %d)", x, y) 16760 } 16761 } 16762 { 16763 var x int16 = 32767 16764 var y int16 = 1 16765 if x == y { 16766 t.Errorf("%d == %d", x, y) 16767 } 16768 if !(x != y) { 16769 t.Errorf("!(%d != %d)", x, y) 16770 } 16771 if x < y { 16772 t.Errorf("%d < %d", x, y) 16773 } 16774 if !(x > y) { 16775 t.Errorf("!(%d > %d)", x, y) 16776 } 16777 if x <= y { 16778 t.Errorf("%d <= %d", x, y) 16779 } 16780 if !(x >= y) { 16781 t.Errorf("!(%d >= %d)", x, y) 16782 } 16783 } 16784 { 16785 var x int16 = 32767 16786 var y int16 = 32766 16787 if x == y { 16788 t.Errorf("%d == %d", x, y) 16789 } 16790 if !(x != y) { 16791 t.Errorf("!(%d != %d)", x, y) 16792 } 16793 if x < y { 16794 t.Errorf("%d < %d", x, y) 16795 } 16796 if !(x > y) { 16797 t.Errorf("!(%d > %d)", x, y) 16798 } 16799 if x <= y { 16800 t.Errorf("%d <= %d", x, y) 16801 } 16802 if !(x >= y) { 16803 t.Errorf("!(%d >= %d)", x, y) 16804 } 16805 } 16806 { 16807 var x int16 = 32767 16808 var y int16 = 32767 16809 if !(x == y) { 16810 t.Errorf("!(%d == %d)", x, y) 16811 } 16812 if x != y { 16813 t.Errorf("%d != %d", x, y) 16814 } 16815 if x < y { 16816 t.Errorf("%d < %d", x, y) 16817 } 16818 if x > y { 16819 t.Errorf("%d > %d", x, y) 16820 } 16821 if !(x <= y) { 16822 t.Errorf("!(%d <= %d)", x, y) 16823 } 16824 if !(x >= y) { 16825 t.Errorf("!(%d >= %d)", x, y) 16826 } 16827 } 16828 } 16829 func TestConstFoldCompareuint8(t *testing.T) { 16830 { 16831 var x uint8 = 0 16832 var y uint8 = 0 16833 if !(x == y) { 16834 t.Errorf("!(%d == %d)", x, y) 16835 } 16836 if x != y { 16837 t.Errorf("%d != %d", x, y) 16838 } 16839 if x < y { 16840 t.Errorf("%d < %d", x, y) 16841 } 16842 if x > y { 16843 t.Errorf("%d > %d", x, y) 16844 } 16845 if !(x <= y) { 16846 t.Errorf("!(%d <= %d)", x, y) 16847 } 16848 if !(x >= y) { 16849 t.Errorf("!(%d >= %d)", x, y) 16850 } 16851 } 16852 { 16853 var x uint8 = 0 16854 var y uint8 = 1 16855 if x == y { 16856 t.Errorf("%d == %d", x, y) 16857 } 16858 if !(x != y) { 16859 t.Errorf("!(%d != %d)", x, y) 16860 } 16861 if !(x < y) { 16862 t.Errorf("!(%d < %d)", x, y) 16863 } 16864 if x > y { 16865 t.Errorf("%d > %d", x, y) 16866 } 16867 if !(x <= y) { 16868 t.Errorf("!(%d <= %d)", x, y) 16869 } 16870 if x >= y { 16871 t.Errorf("%d >= %d", x, y) 16872 } 16873 } 16874 { 16875 var x uint8 = 0 16876 var y uint8 = 255 16877 if x == y { 16878 t.Errorf("%d == %d", x, y) 16879 } 16880 if !(x != y) { 16881 t.Errorf("!(%d != %d)", x, y) 16882 } 16883 if !(x < y) { 16884 t.Errorf("!(%d < %d)", x, y) 16885 } 16886 if x > y { 16887 t.Errorf("%d > %d", x, y) 16888 } 16889 if !(x <= y) { 16890 t.Errorf("!(%d <= %d)", x, y) 16891 } 16892 if x >= y { 16893 t.Errorf("%d >= %d", x, y) 16894 } 16895 } 16896 { 16897 var x uint8 = 1 16898 var y uint8 = 0 16899 if x == y { 16900 t.Errorf("%d == %d", x, y) 16901 } 16902 if !(x != y) { 16903 t.Errorf("!(%d != %d)", x, y) 16904 } 16905 if x < y { 16906 t.Errorf("%d < %d", x, y) 16907 } 16908 if !(x > y) { 16909 t.Errorf("!(%d > %d)", x, y) 16910 } 16911 if x <= y { 16912 t.Errorf("%d <= %d", x, y) 16913 } 16914 if !(x >= y) { 16915 t.Errorf("!(%d >= %d)", x, y) 16916 } 16917 } 16918 { 16919 var x uint8 = 1 16920 var y uint8 = 1 16921 if !(x == y) { 16922 t.Errorf("!(%d == %d)", x, y) 16923 } 16924 if x != y { 16925 t.Errorf("%d != %d", x, y) 16926 } 16927 if x < y { 16928 t.Errorf("%d < %d", x, y) 16929 } 16930 if x > y { 16931 t.Errorf("%d > %d", x, y) 16932 } 16933 if !(x <= y) { 16934 t.Errorf("!(%d <= %d)", x, y) 16935 } 16936 if !(x >= y) { 16937 t.Errorf("!(%d >= %d)", x, y) 16938 } 16939 } 16940 { 16941 var x uint8 = 1 16942 var y uint8 = 255 16943 if x == y { 16944 t.Errorf("%d == %d", x, y) 16945 } 16946 if !(x != y) { 16947 t.Errorf("!(%d != %d)", x, y) 16948 } 16949 if !(x < y) { 16950 t.Errorf("!(%d < %d)", x, y) 16951 } 16952 if x > y { 16953 t.Errorf("%d > %d", x, y) 16954 } 16955 if !(x <= y) { 16956 t.Errorf("!(%d <= %d)", x, y) 16957 } 16958 if x >= y { 16959 t.Errorf("%d >= %d", x, y) 16960 } 16961 } 16962 { 16963 var x uint8 = 255 16964 var y uint8 = 0 16965 if x == y { 16966 t.Errorf("%d == %d", x, y) 16967 } 16968 if !(x != y) { 16969 t.Errorf("!(%d != %d)", x, y) 16970 } 16971 if x < y { 16972 t.Errorf("%d < %d", x, y) 16973 } 16974 if !(x > y) { 16975 t.Errorf("!(%d > %d)", x, y) 16976 } 16977 if x <= y { 16978 t.Errorf("%d <= %d", x, y) 16979 } 16980 if !(x >= y) { 16981 t.Errorf("!(%d >= %d)", x, y) 16982 } 16983 } 16984 { 16985 var x uint8 = 255 16986 var y uint8 = 1 16987 if x == y { 16988 t.Errorf("%d == %d", x, y) 16989 } 16990 if !(x != y) { 16991 t.Errorf("!(%d != %d)", x, y) 16992 } 16993 if x < y { 16994 t.Errorf("%d < %d", x, y) 16995 } 16996 if !(x > y) { 16997 t.Errorf("!(%d > %d)", x, y) 16998 } 16999 if x <= y { 17000 t.Errorf("%d <= %d", x, y) 17001 } 17002 if !(x >= y) { 17003 t.Errorf("!(%d >= %d)", x, y) 17004 } 17005 } 17006 { 17007 var x uint8 = 255 17008 var y uint8 = 255 17009 if !(x == y) { 17010 t.Errorf("!(%d == %d)", x, y) 17011 } 17012 if x != y { 17013 t.Errorf("%d != %d", x, y) 17014 } 17015 if x < y { 17016 t.Errorf("%d < %d", x, y) 17017 } 17018 if x > y { 17019 t.Errorf("%d > %d", x, y) 17020 } 17021 if !(x <= y) { 17022 t.Errorf("!(%d <= %d)", x, y) 17023 } 17024 if !(x >= y) { 17025 t.Errorf("!(%d >= %d)", x, y) 17026 } 17027 } 17028 } 17029 func TestConstFoldCompareint8(t *testing.T) { 17030 { 17031 var x int8 = -128 17032 var y int8 = -128 17033 if !(x == y) { 17034 t.Errorf("!(%d == %d)", x, y) 17035 } 17036 if x != y { 17037 t.Errorf("%d != %d", x, y) 17038 } 17039 if x < y { 17040 t.Errorf("%d < %d", x, y) 17041 } 17042 if x > y { 17043 t.Errorf("%d > %d", x, y) 17044 } 17045 if !(x <= y) { 17046 t.Errorf("!(%d <= %d)", x, y) 17047 } 17048 if !(x >= y) { 17049 t.Errorf("!(%d >= %d)", x, y) 17050 } 17051 } 17052 { 17053 var x int8 = -128 17054 var y int8 = -127 17055 if x == y { 17056 t.Errorf("%d == %d", x, y) 17057 } 17058 if !(x != y) { 17059 t.Errorf("!(%d != %d)", x, y) 17060 } 17061 if !(x < y) { 17062 t.Errorf("!(%d < %d)", x, y) 17063 } 17064 if x > y { 17065 t.Errorf("%d > %d", x, y) 17066 } 17067 if !(x <= y) { 17068 t.Errorf("!(%d <= %d)", x, y) 17069 } 17070 if x >= y { 17071 t.Errorf("%d >= %d", x, y) 17072 } 17073 } 17074 { 17075 var x int8 = -128 17076 var y int8 = -1 17077 if x == y { 17078 t.Errorf("%d == %d", x, y) 17079 } 17080 if !(x != y) { 17081 t.Errorf("!(%d != %d)", x, y) 17082 } 17083 if !(x < y) { 17084 t.Errorf("!(%d < %d)", x, y) 17085 } 17086 if x > y { 17087 t.Errorf("%d > %d", x, y) 17088 } 17089 if !(x <= y) { 17090 t.Errorf("!(%d <= %d)", x, y) 17091 } 17092 if x >= y { 17093 t.Errorf("%d >= %d", x, y) 17094 } 17095 } 17096 { 17097 var x int8 = -128 17098 var y int8 = 0 17099 if x == y { 17100 t.Errorf("%d == %d", x, y) 17101 } 17102 if !(x != y) { 17103 t.Errorf("!(%d != %d)", x, y) 17104 } 17105 if !(x < y) { 17106 t.Errorf("!(%d < %d)", x, y) 17107 } 17108 if x > y { 17109 t.Errorf("%d > %d", x, y) 17110 } 17111 if !(x <= y) { 17112 t.Errorf("!(%d <= %d)", x, y) 17113 } 17114 if x >= y { 17115 t.Errorf("%d >= %d", x, y) 17116 } 17117 } 17118 { 17119 var x int8 = -128 17120 var y int8 = 1 17121 if x == y { 17122 t.Errorf("%d == %d", x, y) 17123 } 17124 if !(x != y) { 17125 t.Errorf("!(%d != %d)", x, y) 17126 } 17127 if !(x < y) { 17128 t.Errorf("!(%d < %d)", x, y) 17129 } 17130 if x > y { 17131 t.Errorf("%d > %d", x, y) 17132 } 17133 if !(x <= y) { 17134 t.Errorf("!(%d <= %d)", x, y) 17135 } 17136 if x >= y { 17137 t.Errorf("%d >= %d", x, y) 17138 } 17139 } 17140 { 17141 var x int8 = -128 17142 var y int8 = 126 17143 if x == y { 17144 t.Errorf("%d == %d", x, y) 17145 } 17146 if !(x != y) { 17147 t.Errorf("!(%d != %d)", x, y) 17148 } 17149 if !(x < y) { 17150 t.Errorf("!(%d < %d)", x, y) 17151 } 17152 if x > y { 17153 t.Errorf("%d > %d", x, y) 17154 } 17155 if !(x <= y) { 17156 t.Errorf("!(%d <= %d)", x, y) 17157 } 17158 if x >= y { 17159 t.Errorf("%d >= %d", x, y) 17160 } 17161 } 17162 { 17163 var x int8 = -128 17164 var y int8 = 127 17165 if x == y { 17166 t.Errorf("%d == %d", x, y) 17167 } 17168 if !(x != y) { 17169 t.Errorf("!(%d != %d)", x, y) 17170 } 17171 if !(x < y) { 17172 t.Errorf("!(%d < %d)", x, y) 17173 } 17174 if x > y { 17175 t.Errorf("%d > %d", x, y) 17176 } 17177 if !(x <= y) { 17178 t.Errorf("!(%d <= %d)", x, y) 17179 } 17180 if x >= y { 17181 t.Errorf("%d >= %d", x, y) 17182 } 17183 } 17184 { 17185 var x int8 = -127 17186 var y int8 = -128 17187 if x == y { 17188 t.Errorf("%d == %d", x, y) 17189 } 17190 if !(x != y) { 17191 t.Errorf("!(%d != %d)", x, y) 17192 } 17193 if x < y { 17194 t.Errorf("%d < %d", x, y) 17195 } 17196 if !(x > y) { 17197 t.Errorf("!(%d > %d)", x, y) 17198 } 17199 if x <= y { 17200 t.Errorf("%d <= %d", x, y) 17201 } 17202 if !(x >= y) { 17203 t.Errorf("!(%d >= %d)", x, y) 17204 } 17205 } 17206 { 17207 var x int8 = -127 17208 var y int8 = -127 17209 if !(x == y) { 17210 t.Errorf("!(%d == %d)", x, y) 17211 } 17212 if x != y { 17213 t.Errorf("%d != %d", x, y) 17214 } 17215 if x < y { 17216 t.Errorf("%d < %d", x, y) 17217 } 17218 if x > y { 17219 t.Errorf("%d > %d", x, y) 17220 } 17221 if !(x <= y) { 17222 t.Errorf("!(%d <= %d)", x, y) 17223 } 17224 if !(x >= y) { 17225 t.Errorf("!(%d >= %d)", x, y) 17226 } 17227 } 17228 { 17229 var x int8 = -127 17230 var y int8 = -1 17231 if x == y { 17232 t.Errorf("%d == %d", x, y) 17233 } 17234 if !(x != y) { 17235 t.Errorf("!(%d != %d)", x, y) 17236 } 17237 if !(x < y) { 17238 t.Errorf("!(%d < %d)", x, y) 17239 } 17240 if x > y { 17241 t.Errorf("%d > %d", x, y) 17242 } 17243 if !(x <= y) { 17244 t.Errorf("!(%d <= %d)", x, y) 17245 } 17246 if x >= y { 17247 t.Errorf("%d >= %d", x, y) 17248 } 17249 } 17250 { 17251 var x int8 = -127 17252 var y int8 = 0 17253 if x == y { 17254 t.Errorf("%d == %d", x, y) 17255 } 17256 if !(x != y) { 17257 t.Errorf("!(%d != %d)", x, y) 17258 } 17259 if !(x < y) { 17260 t.Errorf("!(%d < %d)", x, y) 17261 } 17262 if x > y { 17263 t.Errorf("%d > %d", x, y) 17264 } 17265 if !(x <= y) { 17266 t.Errorf("!(%d <= %d)", x, y) 17267 } 17268 if x >= y { 17269 t.Errorf("%d >= %d", x, y) 17270 } 17271 } 17272 { 17273 var x int8 = -127 17274 var y int8 = 1 17275 if x == y { 17276 t.Errorf("%d == %d", x, y) 17277 } 17278 if !(x != y) { 17279 t.Errorf("!(%d != %d)", x, y) 17280 } 17281 if !(x < y) { 17282 t.Errorf("!(%d < %d)", x, y) 17283 } 17284 if x > y { 17285 t.Errorf("%d > %d", x, y) 17286 } 17287 if !(x <= y) { 17288 t.Errorf("!(%d <= %d)", x, y) 17289 } 17290 if x >= y { 17291 t.Errorf("%d >= %d", x, y) 17292 } 17293 } 17294 { 17295 var x int8 = -127 17296 var y int8 = 126 17297 if x == y { 17298 t.Errorf("%d == %d", x, y) 17299 } 17300 if !(x != y) { 17301 t.Errorf("!(%d != %d)", x, y) 17302 } 17303 if !(x < y) { 17304 t.Errorf("!(%d < %d)", x, y) 17305 } 17306 if x > y { 17307 t.Errorf("%d > %d", x, y) 17308 } 17309 if !(x <= y) { 17310 t.Errorf("!(%d <= %d)", x, y) 17311 } 17312 if x >= y { 17313 t.Errorf("%d >= %d", x, y) 17314 } 17315 } 17316 { 17317 var x int8 = -127 17318 var y int8 = 127 17319 if x == y { 17320 t.Errorf("%d == %d", x, y) 17321 } 17322 if !(x != y) { 17323 t.Errorf("!(%d != %d)", x, y) 17324 } 17325 if !(x < y) { 17326 t.Errorf("!(%d < %d)", x, y) 17327 } 17328 if x > y { 17329 t.Errorf("%d > %d", x, y) 17330 } 17331 if !(x <= y) { 17332 t.Errorf("!(%d <= %d)", x, y) 17333 } 17334 if x >= y { 17335 t.Errorf("%d >= %d", x, y) 17336 } 17337 } 17338 { 17339 var x int8 = -1 17340 var y int8 = -128 17341 if x == y { 17342 t.Errorf("%d == %d", x, y) 17343 } 17344 if !(x != y) { 17345 t.Errorf("!(%d != %d)", x, y) 17346 } 17347 if x < y { 17348 t.Errorf("%d < %d", x, y) 17349 } 17350 if !(x > y) { 17351 t.Errorf("!(%d > %d)", x, y) 17352 } 17353 if x <= y { 17354 t.Errorf("%d <= %d", x, y) 17355 } 17356 if !(x >= y) { 17357 t.Errorf("!(%d >= %d)", x, y) 17358 } 17359 } 17360 { 17361 var x int8 = -1 17362 var y int8 = -127 17363 if x == y { 17364 t.Errorf("%d == %d", x, y) 17365 } 17366 if !(x != y) { 17367 t.Errorf("!(%d != %d)", x, y) 17368 } 17369 if x < y { 17370 t.Errorf("%d < %d", x, y) 17371 } 17372 if !(x > y) { 17373 t.Errorf("!(%d > %d)", x, y) 17374 } 17375 if x <= y { 17376 t.Errorf("%d <= %d", x, y) 17377 } 17378 if !(x >= y) { 17379 t.Errorf("!(%d >= %d)", x, y) 17380 } 17381 } 17382 { 17383 var x int8 = -1 17384 var y int8 = -1 17385 if !(x == y) { 17386 t.Errorf("!(%d == %d)", x, y) 17387 } 17388 if x != y { 17389 t.Errorf("%d != %d", x, y) 17390 } 17391 if x < y { 17392 t.Errorf("%d < %d", x, y) 17393 } 17394 if x > y { 17395 t.Errorf("%d > %d", x, y) 17396 } 17397 if !(x <= y) { 17398 t.Errorf("!(%d <= %d)", x, y) 17399 } 17400 if !(x >= y) { 17401 t.Errorf("!(%d >= %d)", x, y) 17402 } 17403 } 17404 { 17405 var x int8 = -1 17406 var y int8 = 0 17407 if x == y { 17408 t.Errorf("%d == %d", x, y) 17409 } 17410 if !(x != y) { 17411 t.Errorf("!(%d != %d)", x, y) 17412 } 17413 if !(x < y) { 17414 t.Errorf("!(%d < %d)", x, y) 17415 } 17416 if x > y { 17417 t.Errorf("%d > %d", x, y) 17418 } 17419 if !(x <= y) { 17420 t.Errorf("!(%d <= %d)", x, y) 17421 } 17422 if x >= y { 17423 t.Errorf("%d >= %d", x, y) 17424 } 17425 } 17426 { 17427 var x int8 = -1 17428 var y int8 = 1 17429 if x == y { 17430 t.Errorf("%d == %d", x, y) 17431 } 17432 if !(x != y) { 17433 t.Errorf("!(%d != %d)", x, y) 17434 } 17435 if !(x < y) { 17436 t.Errorf("!(%d < %d)", x, y) 17437 } 17438 if x > y { 17439 t.Errorf("%d > %d", x, y) 17440 } 17441 if !(x <= y) { 17442 t.Errorf("!(%d <= %d)", x, y) 17443 } 17444 if x >= y { 17445 t.Errorf("%d >= %d", x, y) 17446 } 17447 } 17448 { 17449 var x int8 = -1 17450 var y int8 = 126 17451 if x == y { 17452 t.Errorf("%d == %d", x, y) 17453 } 17454 if !(x != y) { 17455 t.Errorf("!(%d != %d)", x, y) 17456 } 17457 if !(x < y) { 17458 t.Errorf("!(%d < %d)", x, y) 17459 } 17460 if x > y { 17461 t.Errorf("%d > %d", x, y) 17462 } 17463 if !(x <= y) { 17464 t.Errorf("!(%d <= %d)", x, y) 17465 } 17466 if x >= y { 17467 t.Errorf("%d >= %d", x, y) 17468 } 17469 } 17470 { 17471 var x int8 = -1 17472 var y int8 = 127 17473 if x == y { 17474 t.Errorf("%d == %d", x, y) 17475 } 17476 if !(x != y) { 17477 t.Errorf("!(%d != %d)", x, y) 17478 } 17479 if !(x < y) { 17480 t.Errorf("!(%d < %d)", x, y) 17481 } 17482 if x > y { 17483 t.Errorf("%d > %d", x, y) 17484 } 17485 if !(x <= y) { 17486 t.Errorf("!(%d <= %d)", x, y) 17487 } 17488 if x >= y { 17489 t.Errorf("%d >= %d", x, y) 17490 } 17491 } 17492 { 17493 var x int8 = 0 17494 var y int8 = -128 17495 if x == y { 17496 t.Errorf("%d == %d", x, y) 17497 } 17498 if !(x != y) { 17499 t.Errorf("!(%d != %d)", x, y) 17500 } 17501 if x < y { 17502 t.Errorf("%d < %d", x, y) 17503 } 17504 if !(x > y) { 17505 t.Errorf("!(%d > %d)", x, y) 17506 } 17507 if x <= y { 17508 t.Errorf("%d <= %d", x, y) 17509 } 17510 if !(x >= y) { 17511 t.Errorf("!(%d >= %d)", x, y) 17512 } 17513 } 17514 { 17515 var x int8 = 0 17516 var y int8 = -127 17517 if x == y { 17518 t.Errorf("%d == %d", x, y) 17519 } 17520 if !(x != y) { 17521 t.Errorf("!(%d != %d)", x, y) 17522 } 17523 if x < y { 17524 t.Errorf("%d < %d", x, y) 17525 } 17526 if !(x > y) { 17527 t.Errorf("!(%d > %d)", x, y) 17528 } 17529 if x <= y { 17530 t.Errorf("%d <= %d", x, y) 17531 } 17532 if !(x >= y) { 17533 t.Errorf("!(%d >= %d)", x, y) 17534 } 17535 } 17536 { 17537 var x int8 = 0 17538 var y int8 = -1 17539 if x == y { 17540 t.Errorf("%d == %d", x, y) 17541 } 17542 if !(x != y) { 17543 t.Errorf("!(%d != %d)", x, y) 17544 } 17545 if x < y { 17546 t.Errorf("%d < %d", x, y) 17547 } 17548 if !(x > y) { 17549 t.Errorf("!(%d > %d)", x, y) 17550 } 17551 if x <= y { 17552 t.Errorf("%d <= %d", x, y) 17553 } 17554 if !(x >= y) { 17555 t.Errorf("!(%d >= %d)", x, y) 17556 } 17557 } 17558 { 17559 var x int8 = 0 17560 var y int8 = 0 17561 if !(x == y) { 17562 t.Errorf("!(%d == %d)", x, y) 17563 } 17564 if x != y { 17565 t.Errorf("%d != %d", x, y) 17566 } 17567 if x < y { 17568 t.Errorf("%d < %d", x, y) 17569 } 17570 if x > y { 17571 t.Errorf("%d > %d", x, y) 17572 } 17573 if !(x <= y) { 17574 t.Errorf("!(%d <= %d)", x, y) 17575 } 17576 if !(x >= y) { 17577 t.Errorf("!(%d >= %d)", x, y) 17578 } 17579 } 17580 { 17581 var x int8 = 0 17582 var y int8 = 1 17583 if x == y { 17584 t.Errorf("%d == %d", x, y) 17585 } 17586 if !(x != y) { 17587 t.Errorf("!(%d != %d)", x, y) 17588 } 17589 if !(x < y) { 17590 t.Errorf("!(%d < %d)", x, y) 17591 } 17592 if x > y { 17593 t.Errorf("%d > %d", x, y) 17594 } 17595 if !(x <= y) { 17596 t.Errorf("!(%d <= %d)", x, y) 17597 } 17598 if x >= y { 17599 t.Errorf("%d >= %d", x, y) 17600 } 17601 } 17602 { 17603 var x int8 = 0 17604 var y int8 = 126 17605 if x == y { 17606 t.Errorf("%d == %d", x, y) 17607 } 17608 if !(x != y) { 17609 t.Errorf("!(%d != %d)", x, y) 17610 } 17611 if !(x < y) { 17612 t.Errorf("!(%d < %d)", x, y) 17613 } 17614 if x > y { 17615 t.Errorf("%d > %d", x, y) 17616 } 17617 if !(x <= y) { 17618 t.Errorf("!(%d <= %d)", x, y) 17619 } 17620 if x >= y { 17621 t.Errorf("%d >= %d", x, y) 17622 } 17623 } 17624 { 17625 var x int8 = 0 17626 var y int8 = 127 17627 if x == y { 17628 t.Errorf("%d == %d", x, y) 17629 } 17630 if !(x != y) { 17631 t.Errorf("!(%d != %d)", x, y) 17632 } 17633 if !(x < y) { 17634 t.Errorf("!(%d < %d)", x, y) 17635 } 17636 if x > y { 17637 t.Errorf("%d > %d", x, y) 17638 } 17639 if !(x <= y) { 17640 t.Errorf("!(%d <= %d)", x, y) 17641 } 17642 if x >= y { 17643 t.Errorf("%d >= %d", x, y) 17644 } 17645 } 17646 { 17647 var x int8 = 1 17648 var y int8 = -128 17649 if x == y { 17650 t.Errorf("%d == %d", x, y) 17651 } 17652 if !(x != y) { 17653 t.Errorf("!(%d != %d)", x, y) 17654 } 17655 if x < y { 17656 t.Errorf("%d < %d", x, y) 17657 } 17658 if !(x > y) { 17659 t.Errorf("!(%d > %d)", x, y) 17660 } 17661 if x <= y { 17662 t.Errorf("%d <= %d", x, y) 17663 } 17664 if !(x >= y) { 17665 t.Errorf("!(%d >= %d)", x, y) 17666 } 17667 } 17668 { 17669 var x int8 = 1 17670 var y int8 = -127 17671 if x == y { 17672 t.Errorf("%d == %d", x, y) 17673 } 17674 if !(x != y) { 17675 t.Errorf("!(%d != %d)", x, y) 17676 } 17677 if x < y { 17678 t.Errorf("%d < %d", x, y) 17679 } 17680 if !(x > y) { 17681 t.Errorf("!(%d > %d)", x, y) 17682 } 17683 if x <= y { 17684 t.Errorf("%d <= %d", x, y) 17685 } 17686 if !(x >= y) { 17687 t.Errorf("!(%d >= %d)", x, y) 17688 } 17689 } 17690 { 17691 var x int8 = 1 17692 var y int8 = -1 17693 if x == y { 17694 t.Errorf("%d == %d", x, y) 17695 } 17696 if !(x != y) { 17697 t.Errorf("!(%d != %d)", x, y) 17698 } 17699 if x < y { 17700 t.Errorf("%d < %d", x, y) 17701 } 17702 if !(x > y) { 17703 t.Errorf("!(%d > %d)", x, y) 17704 } 17705 if x <= y { 17706 t.Errorf("%d <= %d", x, y) 17707 } 17708 if !(x >= y) { 17709 t.Errorf("!(%d >= %d)", x, y) 17710 } 17711 } 17712 { 17713 var x int8 = 1 17714 var y int8 = 0 17715 if x == y { 17716 t.Errorf("%d == %d", x, y) 17717 } 17718 if !(x != y) { 17719 t.Errorf("!(%d != %d)", x, y) 17720 } 17721 if x < y { 17722 t.Errorf("%d < %d", x, y) 17723 } 17724 if !(x > y) { 17725 t.Errorf("!(%d > %d)", x, y) 17726 } 17727 if x <= y { 17728 t.Errorf("%d <= %d", x, y) 17729 } 17730 if !(x >= y) { 17731 t.Errorf("!(%d >= %d)", x, y) 17732 } 17733 } 17734 { 17735 var x int8 = 1 17736 var y int8 = 1 17737 if !(x == y) { 17738 t.Errorf("!(%d == %d)", x, y) 17739 } 17740 if x != y { 17741 t.Errorf("%d != %d", x, y) 17742 } 17743 if x < y { 17744 t.Errorf("%d < %d", x, y) 17745 } 17746 if x > y { 17747 t.Errorf("%d > %d", x, y) 17748 } 17749 if !(x <= y) { 17750 t.Errorf("!(%d <= %d)", x, y) 17751 } 17752 if !(x >= y) { 17753 t.Errorf("!(%d >= %d)", x, y) 17754 } 17755 } 17756 { 17757 var x int8 = 1 17758 var y int8 = 126 17759 if x == y { 17760 t.Errorf("%d == %d", x, y) 17761 } 17762 if !(x != y) { 17763 t.Errorf("!(%d != %d)", x, y) 17764 } 17765 if !(x < y) { 17766 t.Errorf("!(%d < %d)", x, y) 17767 } 17768 if x > y { 17769 t.Errorf("%d > %d", x, y) 17770 } 17771 if !(x <= y) { 17772 t.Errorf("!(%d <= %d)", x, y) 17773 } 17774 if x >= y { 17775 t.Errorf("%d >= %d", x, y) 17776 } 17777 } 17778 { 17779 var x int8 = 1 17780 var y int8 = 127 17781 if x == y { 17782 t.Errorf("%d == %d", x, y) 17783 } 17784 if !(x != y) { 17785 t.Errorf("!(%d != %d)", x, y) 17786 } 17787 if !(x < y) { 17788 t.Errorf("!(%d < %d)", x, y) 17789 } 17790 if x > y { 17791 t.Errorf("%d > %d", x, y) 17792 } 17793 if !(x <= y) { 17794 t.Errorf("!(%d <= %d)", x, y) 17795 } 17796 if x >= y { 17797 t.Errorf("%d >= %d", x, y) 17798 } 17799 } 17800 { 17801 var x int8 = 126 17802 var y int8 = -128 17803 if x == y { 17804 t.Errorf("%d == %d", x, y) 17805 } 17806 if !(x != y) { 17807 t.Errorf("!(%d != %d)", x, y) 17808 } 17809 if x < y { 17810 t.Errorf("%d < %d", x, y) 17811 } 17812 if !(x > y) { 17813 t.Errorf("!(%d > %d)", x, y) 17814 } 17815 if x <= y { 17816 t.Errorf("%d <= %d", x, y) 17817 } 17818 if !(x >= y) { 17819 t.Errorf("!(%d >= %d)", x, y) 17820 } 17821 } 17822 { 17823 var x int8 = 126 17824 var y int8 = -127 17825 if x == y { 17826 t.Errorf("%d == %d", x, y) 17827 } 17828 if !(x != y) { 17829 t.Errorf("!(%d != %d)", x, y) 17830 } 17831 if x < y { 17832 t.Errorf("%d < %d", x, y) 17833 } 17834 if !(x > y) { 17835 t.Errorf("!(%d > %d)", x, y) 17836 } 17837 if x <= y { 17838 t.Errorf("%d <= %d", x, y) 17839 } 17840 if !(x >= y) { 17841 t.Errorf("!(%d >= %d)", x, y) 17842 } 17843 } 17844 { 17845 var x int8 = 126 17846 var y int8 = -1 17847 if x == y { 17848 t.Errorf("%d == %d", x, y) 17849 } 17850 if !(x != y) { 17851 t.Errorf("!(%d != %d)", x, y) 17852 } 17853 if x < y { 17854 t.Errorf("%d < %d", x, y) 17855 } 17856 if !(x > y) { 17857 t.Errorf("!(%d > %d)", x, y) 17858 } 17859 if x <= y { 17860 t.Errorf("%d <= %d", x, y) 17861 } 17862 if !(x >= y) { 17863 t.Errorf("!(%d >= %d)", x, y) 17864 } 17865 } 17866 { 17867 var x int8 = 126 17868 var y int8 = 0 17869 if x == y { 17870 t.Errorf("%d == %d", x, y) 17871 } 17872 if !(x != y) { 17873 t.Errorf("!(%d != %d)", x, y) 17874 } 17875 if x < y { 17876 t.Errorf("%d < %d", x, y) 17877 } 17878 if !(x > y) { 17879 t.Errorf("!(%d > %d)", x, y) 17880 } 17881 if x <= y { 17882 t.Errorf("%d <= %d", x, y) 17883 } 17884 if !(x >= y) { 17885 t.Errorf("!(%d >= %d)", x, y) 17886 } 17887 } 17888 { 17889 var x int8 = 126 17890 var y int8 = 1 17891 if x == y { 17892 t.Errorf("%d == %d", x, y) 17893 } 17894 if !(x != y) { 17895 t.Errorf("!(%d != %d)", x, y) 17896 } 17897 if x < y { 17898 t.Errorf("%d < %d", x, y) 17899 } 17900 if !(x > y) { 17901 t.Errorf("!(%d > %d)", x, y) 17902 } 17903 if x <= y { 17904 t.Errorf("%d <= %d", x, y) 17905 } 17906 if !(x >= y) { 17907 t.Errorf("!(%d >= %d)", x, y) 17908 } 17909 } 17910 { 17911 var x int8 = 126 17912 var y int8 = 126 17913 if !(x == y) { 17914 t.Errorf("!(%d == %d)", x, y) 17915 } 17916 if x != y { 17917 t.Errorf("%d != %d", x, y) 17918 } 17919 if x < y { 17920 t.Errorf("%d < %d", x, y) 17921 } 17922 if x > y { 17923 t.Errorf("%d > %d", x, y) 17924 } 17925 if !(x <= y) { 17926 t.Errorf("!(%d <= %d)", x, y) 17927 } 17928 if !(x >= y) { 17929 t.Errorf("!(%d >= %d)", x, y) 17930 } 17931 } 17932 { 17933 var x int8 = 126 17934 var y int8 = 127 17935 if x == y { 17936 t.Errorf("%d == %d", x, y) 17937 } 17938 if !(x != y) { 17939 t.Errorf("!(%d != %d)", x, y) 17940 } 17941 if !(x < y) { 17942 t.Errorf("!(%d < %d)", x, y) 17943 } 17944 if x > y { 17945 t.Errorf("%d > %d", x, y) 17946 } 17947 if !(x <= y) { 17948 t.Errorf("!(%d <= %d)", x, y) 17949 } 17950 if x >= y { 17951 t.Errorf("%d >= %d", x, y) 17952 } 17953 } 17954 { 17955 var x int8 = 127 17956 var y int8 = -128 17957 if x == y { 17958 t.Errorf("%d == %d", x, y) 17959 } 17960 if !(x != y) { 17961 t.Errorf("!(%d != %d)", x, y) 17962 } 17963 if x < y { 17964 t.Errorf("%d < %d", x, y) 17965 } 17966 if !(x > y) { 17967 t.Errorf("!(%d > %d)", x, y) 17968 } 17969 if x <= y { 17970 t.Errorf("%d <= %d", x, y) 17971 } 17972 if !(x >= y) { 17973 t.Errorf("!(%d >= %d)", x, y) 17974 } 17975 } 17976 { 17977 var x int8 = 127 17978 var y int8 = -127 17979 if x == y { 17980 t.Errorf("%d == %d", x, y) 17981 } 17982 if !(x != y) { 17983 t.Errorf("!(%d != %d)", x, y) 17984 } 17985 if x < y { 17986 t.Errorf("%d < %d", x, y) 17987 } 17988 if !(x > y) { 17989 t.Errorf("!(%d > %d)", x, y) 17990 } 17991 if x <= y { 17992 t.Errorf("%d <= %d", x, y) 17993 } 17994 if !(x >= y) { 17995 t.Errorf("!(%d >= %d)", x, y) 17996 } 17997 } 17998 { 17999 var x int8 = 127 18000 var y int8 = -1 18001 if x == y { 18002 t.Errorf("%d == %d", x, y) 18003 } 18004 if !(x != y) { 18005 t.Errorf("!(%d != %d)", x, y) 18006 } 18007 if x < y { 18008 t.Errorf("%d < %d", x, y) 18009 } 18010 if !(x > y) { 18011 t.Errorf("!(%d > %d)", x, y) 18012 } 18013 if x <= y { 18014 t.Errorf("%d <= %d", x, y) 18015 } 18016 if !(x >= y) { 18017 t.Errorf("!(%d >= %d)", x, y) 18018 } 18019 } 18020 { 18021 var x int8 = 127 18022 var y int8 = 0 18023 if x == y { 18024 t.Errorf("%d == %d", x, y) 18025 } 18026 if !(x != y) { 18027 t.Errorf("!(%d != %d)", x, y) 18028 } 18029 if x < y { 18030 t.Errorf("%d < %d", x, y) 18031 } 18032 if !(x > y) { 18033 t.Errorf("!(%d > %d)", x, y) 18034 } 18035 if x <= y { 18036 t.Errorf("%d <= %d", x, y) 18037 } 18038 if !(x >= y) { 18039 t.Errorf("!(%d >= %d)", x, y) 18040 } 18041 } 18042 { 18043 var x int8 = 127 18044 var y int8 = 1 18045 if x == y { 18046 t.Errorf("%d == %d", x, y) 18047 } 18048 if !(x != y) { 18049 t.Errorf("!(%d != %d)", x, y) 18050 } 18051 if x < y { 18052 t.Errorf("%d < %d", x, y) 18053 } 18054 if !(x > y) { 18055 t.Errorf("!(%d > %d)", x, y) 18056 } 18057 if x <= y { 18058 t.Errorf("%d <= %d", x, y) 18059 } 18060 if !(x >= y) { 18061 t.Errorf("!(%d >= %d)", x, y) 18062 } 18063 } 18064 { 18065 var x int8 = 127 18066 var y int8 = 126 18067 if x == y { 18068 t.Errorf("%d == %d", x, y) 18069 } 18070 if !(x != y) { 18071 t.Errorf("!(%d != %d)", x, y) 18072 } 18073 if x < y { 18074 t.Errorf("%d < %d", x, y) 18075 } 18076 if !(x > y) { 18077 t.Errorf("!(%d > %d)", x, y) 18078 } 18079 if x <= y { 18080 t.Errorf("%d <= %d", x, y) 18081 } 18082 if !(x >= y) { 18083 t.Errorf("!(%d >= %d)", x, y) 18084 } 18085 } 18086 { 18087 var x int8 = 127 18088 var y int8 = 127 18089 if !(x == y) { 18090 t.Errorf("!(%d == %d)", x, y) 18091 } 18092 if x != y { 18093 t.Errorf("%d != %d", x, y) 18094 } 18095 if x < y { 18096 t.Errorf("%d < %d", x, y) 18097 } 18098 if x > y { 18099 t.Errorf("%d > %d", x, y) 18100 } 18101 if !(x <= y) { 18102 t.Errorf("!(%d <= %d)", x, y) 18103 } 18104 if !(x >= y) { 18105 t.Errorf("!(%d >= %d)", x, y) 18106 } 18107 } 18108 } 18109