github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/compile/internal/gc/constFold_test.go (about) 1 // run 2 // Code generated by gen/constFoldGen.go. DO NOT EDIT. 3 4 package gc 5 6 import "testing" 7 8 func TestConstFolduint64add(t *testing.T) { 9 var x, y, r uint64 10 x = 0 11 y = 0 12 r = x + y 13 if r != 0 { 14 t.Errorf("0 %s 0 = %d, want 0", "+", r) 15 } 16 y = 1 17 r = x + y 18 if r != 1 { 19 t.Errorf("0 %s 1 = %d, want 1", "+", r) 20 } 21 y = 4294967296 22 r = x + y 23 if r != 4294967296 { 24 t.Errorf("0 %s 4294967296 = %d, want 4294967296", "+", r) 25 } 26 y = 18446744073709551615 27 r = x + y 28 if r != 18446744073709551615 { 29 t.Errorf("0 %s 18446744073709551615 = %d, want 18446744073709551615", "+", r) 30 } 31 x = 1 32 y = 0 33 r = x + y 34 if r != 1 { 35 t.Errorf("1 %s 0 = %d, want 1", "+", r) 36 } 37 y = 1 38 r = x + y 39 if r != 2 { 40 t.Errorf("1 %s 1 = %d, want 2", "+", r) 41 } 42 y = 4294967296 43 r = x + y 44 if r != 4294967297 { 45 t.Errorf("1 %s 4294967296 = %d, want 4294967297", "+", r) 46 } 47 y = 18446744073709551615 48 r = x + y 49 if r != 0 { 50 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "+", r) 51 } 52 x = 4294967296 53 y = 0 54 r = x + y 55 if r != 4294967296 { 56 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "+", r) 57 } 58 y = 1 59 r = x + y 60 if r != 4294967297 { 61 t.Errorf("4294967296 %s 1 = %d, want 4294967297", "+", r) 62 } 63 y = 4294967296 64 r = x + y 65 if r != 8589934592 { 66 t.Errorf("4294967296 %s 4294967296 = %d, want 8589934592", "+", r) 67 } 68 y = 18446744073709551615 69 r = x + y 70 if r != 4294967295 { 71 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 4294967295", "+", r) 72 } 73 x = 18446744073709551615 74 y = 0 75 r = x + y 76 if r != 18446744073709551615 { 77 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "+", r) 78 } 79 y = 1 80 r = x + y 81 if r != 0 { 82 t.Errorf("18446744073709551615 %s 1 = %d, want 0", "+", r) 83 } 84 y = 4294967296 85 r = x + y 86 if r != 4294967295 { 87 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 4294967295", "+", r) 88 } 89 y = 18446744073709551615 90 r = x + y 91 if r != 18446744073709551614 { 92 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 18446744073709551614", "+", r) 93 } 94 } 95 func TestConstFolduint64sub(t *testing.T) { 96 var x, y, r uint64 97 x = 0 98 y = 0 99 r = x - y 100 if r != 0 { 101 t.Errorf("0 %s 0 = %d, want 0", "-", r) 102 } 103 y = 1 104 r = x - y 105 if r != 18446744073709551615 { 106 t.Errorf("0 %s 1 = %d, want 18446744073709551615", "-", r) 107 } 108 y = 4294967296 109 r = x - y 110 if r != 18446744069414584320 { 111 t.Errorf("0 %s 4294967296 = %d, want 18446744069414584320", "-", r) 112 } 113 y = 18446744073709551615 114 r = x - y 115 if r != 1 { 116 t.Errorf("0 %s 18446744073709551615 = %d, want 1", "-", r) 117 } 118 x = 1 119 y = 0 120 r = x - y 121 if r != 1 { 122 t.Errorf("1 %s 0 = %d, want 1", "-", r) 123 } 124 y = 1 125 r = x - y 126 if r != 0 { 127 t.Errorf("1 %s 1 = %d, want 0", "-", r) 128 } 129 y = 4294967296 130 r = x - y 131 if r != 18446744069414584321 { 132 t.Errorf("1 %s 4294967296 = %d, want 18446744069414584321", "-", r) 133 } 134 y = 18446744073709551615 135 r = x - y 136 if r != 2 { 137 t.Errorf("1 %s 18446744073709551615 = %d, want 2", "-", r) 138 } 139 x = 4294967296 140 y = 0 141 r = x - y 142 if r != 4294967296 { 143 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "-", r) 144 } 145 y = 1 146 r = x - y 147 if r != 4294967295 { 148 t.Errorf("4294967296 %s 1 = %d, want 4294967295", "-", r) 149 } 150 y = 4294967296 151 r = x - y 152 if r != 0 { 153 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "-", r) 154 } 155 y = 18446744073709551615 156 r = x - y 157 if r != 4294967297 { 158 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 4294967297", "-", r) 159 } 160 x = 18446744073709551615 161 y = 0 162 r = x - y 163 if r != 18446744073709551615 { 164 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "-", r) 165 } 166 y = 1 167 r = x - y 168 if r != 18446744073709551614 { 169 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "-", r) 170 } 171 y = 4294967296 172 r = x - y 173 if r != 18446744069414584319 { 174 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 18446744069414584319", "-", r) 175 } 176 y = 18446744073709551615 177 r = x - y 178 if r != 0 { 179 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 0", "-", r) 180 } 181 } 182 func TestConstFolduint64div(t *testing.T) { 183 var x, y, r uint64 184 x = 0 185 y = 1 186 r = x / y 187 if r != 0 { 188 t.Errorf("0 %s 1 = %d, want 0", "/", r) 189 } 190 y = 4294967296 191 r = x / y 192 if r != 0 { 193 t.Errorf("0 %s 4294967296 = %d, want 0", "/", r) 194 } 195 y = 18446744073709551615 196 r = x / y 197 if r != 0 { 198 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "/", r) 199 } 200 x = 1 201 y = 1 202 r = x / y 203 if r != 1 { 204 t.Errorf("1 %s 1 = %d, want 1", "/", r) 205 } 206 y = 4294967296 207 r = x / y 208 if r != 0 { 209 t.Errorf("1 %s 4294967296 = %d, want 0", "/", r) 210 } 211 y = 18446744073709551615 212 r = x / y 213 if r != 0 { 214 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "/", r) 215 } 216 x = 4294967296 217 y = 1 218 r = x / y 219 if r != 4294967296 { 220 t.Errorf("4294967296 %s 1 = %d, want 4294967296", "/", r) 221 } 222 y = 4294967296 223 r = x / y 224 if r != 1 { 225 t.Errorf("4294967296 %s 4294967296 = %d, want 1", "/", r) 226 } 227 y = 18446744073709551615 228 r = x / y 229 if r != 0 { 230 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", "/", r) 231 } 232 x = 18446744073709551615 233 y = 1 234 r = x / y 235 if r != 18446744073709551615 { 236 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551615", "/", r) 237 } 238 y = 4294967296 239 r = x / y 240 if r != 4294967295 { 241 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 4294967295", "/", r) 242 } 243 y = 18446744073709551615 244 r = x / y 245 if r != 1 { 246 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 1", "/", r) 247 } 248 } 249 func TestConstFolduint64mul(t *testing.T) { 250 var x, y, r uint64 251 x = 0 252 y = 0 253 r = x * y 254 if r != 0 { 255 t.Errorf("0 %s 0 = %d, want 0", "*", r) 256 } 257 y = 1 258 r = x * y 259 if r != 0 { 260 t.Errorf("0 %s 1 = %d, want 0", "*", r) 261 } 262 y = 4294967296 263 r = x * y 264 if r != 0 { 265 t.Errorf("0 %s 4294967296 = %d, want 0", "*", r) 266 } 267 y = 18446744073709551615 268 r = x * y 269 if r != 0 { 270 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "*", r) 271 } 272 x = 1 273 y = 0 274 r = x * y 275 if r != 0 { 276 t.Errorf("1 %s 0 = %d, want 0", "*", r) 277 } 278 y = 1 279 r = x * y 280 if r != 1 { 281 t.Errorf("1 %s 1 = %d, want 1", "*", r) 282 } 283 y = 4294967296 284 r = x * y 285 if r != 4294967296 { 286 t.Errorf("1 %s 4294967296 = %d, want 4294967296", "*", r) 287 } 288 y = 18446744073709551615 289 r = x * y 290 if r != 18446744073709551615 { 291 t.Errorf("1 %s 18446744073709551615 = %d, want 18446744073709551615", "*", r) 292 } 293 x = 4294967296 294 y = 0 295 r = x * y 296 if r != 0 { 297 t.Errorf("4294967296 %s 0 = %d, want 0", "*", r) 298 } 299 y = 1 300 r = x * y 301 if r != 4294967296 { 302 t.Errorf("4294967296 %s 1 = %d, want 4294967296", "*", r) 303 } 304 y = 4294967296 305 r = x * y 306 if r != 0 { 307 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "*", r) 308 } 309 y = 18446744073709551615 310 r = x * y 311 if r != 18446744069414584320 { 312 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 18446744069414584320", "*", r) 313 } 314 x = 18446744073709551615 315 y = 0 316 r = x * y 317 if r != 0 { 318 t.Errorf("18446744073709551615 %s 0 = %d, want 0", "*", r) 319 } 320 y = 1 321 r = x * y 322 if r != 18446744073709551615 { 323 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551615", "*", r) 324 } 325 y = 4294967296 326 r = x * y 327 if r != 18446744069414584320 { 328 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 18446744069414584320", "*", r) 329 } 330 y = 18446744073709551615 331 r = x * y 332 if r != 1 { 333 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 1", "*", r) 334 } 335 } 336 func TestConstFolduint64mod(t *testing.T) { 337 var x, y, r uint64 338 x = 0 339 y = 1 340 r = x % y 341 if r != 0 { 342 t.Errorf("0 %s 1 = %d, want 0", "%", r) 343 } 344 y = 4294967296 345 r = x % y 346 if r != 0 { 347 t.Errorf("0 %s 4294967296 = %d, want 0", "%", r) 348 } 349 y = 18446744073709551615 350 r = x % y 351 if r != 0 { 352 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "%", r) 353 } 354 x = 1 355 y = 1 356 r = x % y 357 if r != 0 { 358 t.Errorf("1 %s 1 = %d, want 0", "%", r) 359 } 360 y = 4294967296 361 r = x % y 362 if r != 1 { 363 t.Errorf("1 %s 4294967296 = %d, want 1", "%", r) 364 } 365 y = 18446744073709551615 366 r = x % y 367 if r != 1 { 368 t.Errorf("1 %s 18446744073709551615 = %d, want 1", "%", r) 369 } 370 x = 4294967296 371 y = 1 372 r = x % y 373 if r != 0 { 374 t.Errorf("4294967296 %s 1 = %d, want 0", "%", r) 375 } 376 y = 4294967296 377 r = x % y 378 if r != 0 { 379 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "%", r) 380 } 381 y = 18446744073709551615 382 r = x % y 383 if r != 4294967296 { 384 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 4294967296", "%", r) 385 } 386 x = 18446744073709551615 387 y = 1 388 r = x % y 389 if r != 0 { 390 t.Errorf("18446744073709551615 %s 1 = %d, want 0", "%", r) 391 } 392 y = 4294967296 393 r = x % y 394 if r != 4294967295 { 395 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 4294967295", "%", r) 396 } 397 y = 18446744073709551615 398 r = x % y 399 if r != 0 { 400 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 0", "%", r) 401 } 402 } 403 func TestConstFoldint64add(t *testing.T) { 404 var x, y, r int64 405 x = -9223372036854775808 406 y = -9223372036854775808 407 r = x + y 408 if r != 0 { 409 t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "+", r) 410 } 411 y = -9223372036854775807 412 r = x + y 413 if r != 1 { 414 t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want 1", "+", r) 415 } 416 y = -4294967296 417 r = x + y 418 if r != 9223372032559808512 { 419 t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 9223372032559808512", "+", r) 420 } 421 y = -1 422 r = x + y 423 if r != 9223372036854775807 { 424 t.Errorf("-9223372036854775808 %s -1 = %d, want 9223372036854775807", "+", r) 425 } 426 y = 0 427 r = x + y 428 if r != -9223372036854775808 { 429 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "+", r) 430 } 431 y = 1 432 r = x + y 433 if r != -9223372036854775807 { 434 t.Errorf("-9223372036854775808 %s 1 = %d, want -9223372036854775807", "+", r) 435 } 436 y = 4294967296 437 r = x + y 438 if r != -9223372032559808512 { 439 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want -9223372032559808512", "+", r) 440 } 441 y = 9223372036854775806 442 r = x + y 443 if r != -2 { 444 t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want -2", "+", r) 445 } 446 y = 9223372036854775807 447 r = x + y 448 if r != -1 { 449 t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -1", "+", r) 450 } 451 x = -9223372036854775807 452 y = -9223372036854775808 453 r = x + y 454 if r != 1 { 455 t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want 1", "+", r) 456 } 457 y = -9223372036854775807 458 r = x + y 459 if r != 2 { 460 t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 2", "+", r) 461 } 462 y = -4294967296 463 r = x + y 464 if r != 9223372032559808513 { 465 t.Errorf("-9223372036854775807 %s -4294967296 = %d, want 9223372032559808513", "+", r) 466 } 467 y = -1 468 r = x + y 469 if r != -9223372036854775808 { 470 t.Errorf("-9223372036854775807 %s -1 = %d, want -9223372036854775808", "+", r) 471 } 472 y = 0 473 r = x + y 474 if r != -9223372036854775807 { 475 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "+", r) 476 } 477 y = 1 478 r = x + y 479 if r != -9223372036854775806 { 480 t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775806", "+", r) 481 } 482 y = 4294967296 483 r = x + y 484 if r != -9223372032559808511 { 485 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -9223372032559808511", "+", r) 486 } 487 y = 9223372036854775806 488 r = x + y 489 if r != -1 { 490 t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want -1", "+", r) 491 } 492 y = 9223372036854775807 493 r = x + y 494 if r != 0 { 495 t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want 0", "+", r) 496 } 497 x = -4294967296 498 y = -9223372036854775808 499 r = x + y 500 if r != 9223372032559808512 { 501 t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 9223372032559808512", "+", r) 502 } 503 y = -9223372036854775807 504 r = x + y 505 if r != 9223372032559808513 { 506 t.Errorf("-4294967296 %s -9223372036854775807 = %d, want 9223372032559808513", "+", r) 507 } 508 y = -4294967296 509 r = x + y 510 if r != -8589934592 { 511 t.Errorf("-4294967296 %s -4294967296 = %d, want -8589934592", "+", r) 512 } 513 y = -1 514 r = x + y 515 if r != -4294967297 { 516 t.Errorf("-4294967296 %s -1 = %d, want -4294967297", "+", r) 517 } 518 y = 0 519 r = x + y 520 if r != -4294967296 { 521 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "+", r) 522 } 523 y = 1 524 r = x + y 525 if r != -4294967295 { 526 t.Errorf("-4294967296 %s 1 = %d, want -4294967295", "+", r) 527 } 528 y = 4294967296 529 r = x + y 530 if r != 0 { 531 t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "+", r) 532 } 533 y = 9223372036854775806 534 r = x + y 535 if r != 9223372032559808510 { 536 t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 9223372032559808510", "+", r) 537 } 538 y = 9223372036854775807 539 r = x + y 540 if r != 9223372032559808511 { 541 t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 9223372032559808511", "+", r) 542 } 543 x = -1 544 y = -9223372036854775808 545 r = x + y 546 if r != 9223372036854775807 { 547 t.Errorf("-1 %s -9223372036854775808 = %d, want 9223372036854775807", "+", r) 548 } 549 y = -9223372036854775807 550 r = x + y 551 if r != -9223372036854775808 { 552 t.Errorf("-1 %s -9223372036854775807 = %d, want -9223372036854775808", "+", r) 553 } 554 y = -4294967296 555 r = x + y 556 if r != -4294967297 { 557 t.Errorf("-1 %s -4294967296 = %d, want -4294967297", "+", r) 558 } 559 y = -1 560 r = x + y 561 if r != -2 { 562 t.Errorf("-1 %s -1 = %d, want -2", "+", r) 563 } 564 y = 0 565 r = x + y 566 if r != -1 { 567 t.Errorf("-1 %s 0 = %d, want -1", "+", r) 568 } 569 y = 1 570 r = x + y 571 if r != 0 { 572 t.Errorf("-1 %s 1 = %d, want 0", "+", r) 573 } 574 y = 4294967296 575 r = x + y 576 if r != 4294967295 { 577 t.Errorf("-1 %s 4294967296 = %d, want 4294967295", "+", r) 578 } 579 y = 9223372036854775806 580 r = x + y 581 if r != 9223372036854775805 { 582 t.Errorf("-1 %s 9223372036854775806 = %d, want 9223372036854775805", "+", r) 583 } 584 y = 9223372036854775807 585 r = x + y 586 if r != 9223372036854775806 { 587 t.Errorf("-1 %s 9223372036854775807 = %d, want 9223372036854775806", "+", r) 588 } 589 x = 0 590 y = -9223372036854775808 591 r = x + y 592 if r != -9223372036854775808 { 593 t.Errorf("0 %s -9223372036854775808 = %d, want -9223372036854775808", "+", r) 594 } 595 y = -9223372036854775807 596 r = x + y 597 if r != -9223372036854775807 { 598 t.Errorf("0 %s -9223372036854775807 = %d, want -9223372036854775807", "+", r) 599 } 600 y = -4294967296 601 r = x + y 602 if r != -4294967296 { 603 t.Errorf("0 %s -4294967296 = %d, want -4294967296", "+", r) 604 } 605 y = -1 606 r = x + y 607 if r != -1 { 608 t.Errorf("0 %s -1 = %d, want -1", "+", r) 609 } 610 y = 0 611 r = x + y 612 if r != 0 { 613 t.Errorf("0 %s 0 = %d, want 0", "+", r) 614 } 615 y = 1 616 r = x + y 617 if r != 1 { 618 t.Errorf("0 %s 1 = %d, want 1", "+", r) 619 } 620 y = 4294967296 621 r = x + y 622 if r != 4294967296 { 623 t.Errorf("0 %s 4294967296 = %d, want 4294967296", "+", r) 624 } 625 y = 9223372036854775806 626 r = x + y 627 if r != 9223372036854775806 { 628 t.Errorf("0 %s 9223372036854775806 = %d, want 9223372036854775806", "+", r) 629 } 630 y = 9223372036854775807 631 r = x + y 632 if r != 9223372036854775807 { 633 t.Errorf("0 %s 9223372036854775807 = %d, want 9223372036854775807", "+", r) 634 } 635 x = 1 636 y = -9223372036854775808 637 r = x + y 638 if r != -9223372036854775807 { 639 t.Errorf("1 %s -9223372036854775808 = %d, want -9223372036854775807", "+", r) 640 } 641 y = -9223372036854775807 642 r = x + y 643 if r != -9223372036854775806 { 644 t.Errorf("1 %s -9223372036854775807 = %d, want -9223372036854775806", "+", r) 645 } 646 y = -4294967296 647 r = x + y 648 if r != -4294967295 { 649 t.Errorf("1 %s -4294967296 = %d, want -4294967295", "+", r) 650 } 651 y = -1 652 r = x + y 653 if r != 0 { 654 t.Errorf("1 %s -1 = %d, want 0", "+", r) 655 } 656 y = 0 657 r = x + y 658 if r != 1 { 659 t.Errorf("1 %s 0 = %d, want 1", "+", r) 660 } 661 y = 1 662 r = x + y 663 if r != 2 { 664 t.Errorf("1 %s 1 = %d, want 2", "+", r) 665 } 666 y = 4294967296 667 r = x + y 668 if r != 4294967297 { 669 t.Errorf("1 %s 4294967296 = %d, want 4294967297", "+", r) 670 } 671 y = 9223372036854775806 672 r = x + y 673 if r != 9223372036854775807 { 674 t.Errorf("1 %s 9223372036854775806 = %d, want 9223372036854775807", "+", r) 675 } 676 y = 9223372036854775807 677 r = x + y 678 if r != -9223372036854775808 { 679 t.Errorf("1 %s 9223372036854775807 = %d, want -9223372036854775808", "+", r) 680 } 681 x = 4294967296 682 y = -9223372036854775808 683 r = x + y 684 if r != -9223372032559808512 { 685 t.Errorf("4294967296 %s -9223372036854775808 = %d, want -9223372032559808512", "+", r) 686 } 687 y = -9223372036854775807 688 r = x + y 689 if r != -9223372032559808511 { 690 t.Errorf("4294967296 %s -9223372036854775807 = %d, want -9223372032559808511", "+", r) 691 } 692 y = -4294967296 693 r = x + y 694 if r != 0 { 695 t.Errorf("4294967296 %s -4294967296 = %d, want 0", "+", r) 696 } 697 y = -1 698 r = x + y 699 if r != 4294967295 { 700 t.Errorf("4294967296 %s -1 = %d, want 4294967295", "+", r) 701 } 702 y = 0 703 r = x + y 704 if r != 4294967296 { 705 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "+", r) 706 } 707 y = 1 708 r = x + y 709 if r != 4294967297 { 710 t.Errorf("4294967296 %s 1 = %d, want 4294967297", "+", r) 711 } 712 y = 4294967296 713 r = x + y 714 if r != 8589934592 { 715 t.Errorf("4294967296 %s 4294967296 = %d, want 8589934592", "+", r) 716 } 717 y = 9223372036854775806 718 r = x + y 719 if r != -9223372032559808514 { 720 t.Errorf("4294967296 %s 9223372036854775806 = %d, want -9223372032559808514", "+", r) 721 } 722 y = 9223372036854775807 723 r = x + y 724 if r != -9223372032559808513 { 725 t.Errorf("4294967296 %s 9223372036854775807 = %d, want -9223372032559808513", "+", r) 726 } 727 x = 9223372036854775806 728 y = -9223372036854775808 729 r = x + y 730 if r != -2 { 731 t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want -2", "+", r) 732 } 733 y = -9223372036854775807 734 r = x + y 735 if r != -1 { 736 t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want -1", "+", r) 737 } 738 y = -4294967296 739 r = x + y 740 if r != 9223372032559808510 { 741 t.Errorf("9223372036854775806 %s -4294967296 = %d, want 9223372032559808510", "+", r) 742 } 743 y = -1 744 r = x + y 745 if r != 9223372036854775805 { 746 t.Errorf("9223372036854775806 %s -1 = %d, want 9223372036854775805", "+", r) 747 } 748 y = 0 749 r = x + y 750 if r != 9223372036854775806 { 751 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "+", r) 752 } 753 y = 1 754 r = x + y 755 if r != 9223372036854775807 { 756 t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775807", "+", r) 757 } 758 y = 4294967296 759 r = x + y 760 if r != -9223372032559808514 { 761 t.Errorf("9223372036854775806 %s 4294967296 = %d, want -9223372032559808514", "+", r) 762 } 763 y = 9223372036854775806 764 r = x + y 765 if r != -4 { 766 t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want -4", "+", r) 767 } 768 y = 9223372036854775807 769 r = x + y 770 if r != -3 { 771 t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want -3", "+", r) 772 } 773 x = 9223372036854775807 774 y = -9223372036854775808 775 r = x + y 776 if r != -1 { 777 t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want -1", "+", r) 778 } 779 y = -9223372036854775807 780 r = x + y 781 if r != 0 { 782 t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want 0", "+", r) 783 } 784 y = -4294967296 785 r = x + y 786 if r != 9223372032559808511 { 787 t.Errorf("9223372036854775807 %s -4294967296 = %d, want 9223372032559808511", "+", r) 788 } 789 y = -1 790 r = x + y 791 if r != 9223372036854775806 { 792 t.Errorf("9223372036854775807 %s -1 = %d, want 9223372036854775806", "+", r) 793 } 794 y = 0 795 r = x + y 796 if r != 9223372036854775807 { 797 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "+", r) 798 } 799 y = 1 800 r = x + y 801 if r != -9223372036854775808 { 802 t.Errorf("9223372036854775807 %s 1 = %d, want -9223372036854775808", "+", r) 803 } 804 y = 4294967296 805 r = x + y 806 if r != -9223372032559808513 { 807 t.Errorf("9223372036854775807 %s 4294967296 = %d, want -9223372032559808513", "+", r) 808 } 809 y = 9223372036854775806 810 r = x + y 811 if r != -3 { 812 t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want -3", "+", r) 813 } 814 y = 9223372036854775807 815 r = x + y 816 if r != -2 { 817 t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want -2", "+", r) 818 } 819 } 820 func TestConstFoldint64sub(t *testing.T) { 821 var x, y, r int64 822 x = -9223372036854775808 823 y = -9223372036854775808 824 r = x - y 825 if r != 0 { 826 t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "-", r) 827 } 828 y = -9223372036854775807 829 r = x - y 830 if r != -1 { 831 t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want -1", "-", r) 832 } 833 y = -4294967296 834 r = x - y 835 if r != -9223372032559808512 { 836 t.Errorf("-9223372036854775808 %s -4294967296 = %d, want -9223372032559808512", "-", r) 837 } 838 y = -1 839 r = x - y 840 if r != -9223372036854775807 { 841 t.Errorf("-9223372036854775808 %s -1 = %d, want -9223372036854775807", "-", r) 842 } 843 y = 0 844 r = x - y 845 if r != -9223372036854775808 { 846 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "-", r) 847 } 848 y = 1 849 r = x - y 850 if r != 9223372036854775807 { 851 t.Errorf("-9223372036854775808 %s 1 = %d, want 9223372036854775807", "-", r) 852 } 853 y = 4294967296 854 r = x - y 855 if r != 9223372032559808512 { 856 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 9223372032559808512", "-", r) 857 } 858 y = 9223372036854775806 859 r = x - y 860 if r != 2 { 861 t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want 2", "-", r) 862 } 863 y = 9223372036854775807 864 r = x - y 865 if r != 1 { 866 t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want 1", "-", r) 867 } 868 x = -9223372036854775807 869 y = -9223372036854775808 870 r = x - y 871 if r != 1 { 872 t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want 1", "-", r) 873 } 874 y = -9223372036854775807 875 r = x - y 876 if r != 0 { 877 t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 0", "-", r) 878 } 879 y = -4294967296 880 r = x - y 881 if r != -9223372032559808511 { 882 t.Errorf("-9223372036854775807 %s -4294967296 = %d, want -9223372032559808511", "-", r) 883 } 884 y = -1 885 r = x - y 886 if r != -9223372036854775806 { 887 t.Errorf("-9223372036854775807 %s -1 = %d, want -9223372036854775806", "-", r) 888 } 889 y = 0 890 r = x - y 891 if r != -9223372036854775807 { 892 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "-", r) 893 } 894 y = 1 895 r = x - y 896 if r != -9223372036854775808 { 897 t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775808", "-", r) 898 } 899 y = 4294967296 900 r = x - y 901 if r != 9223372032559808513 { 902 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want 9223372032559808513", "-", r) 903 } 904 y = 9223372036854775806 905 r = x - y 906 if r != 3 { 907 t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want 3", "-", r) 908 } 909 y = 9223372036854775807 910 r = x - y 911 if r != 2 { 912 t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want 2", "-", r) 913 } 914 x = -4294967296 915 y = -9223372036854775808 916 r = x - y 917 if r != 9223372032559808512 { 918 t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 9223372032559808512", "-", r) 919 } 920 y = -9223372036854775807 921 r = x - y 922 if r != 9223372032559808511 { 923 t.Errorf("-4294967296 %s -9223372036854775807 = %d, want 9223372032559808511", "-", r) 924 } 925 y = -4294967296 926 r = x - y 927 if r != 0 { 928 t.Errorf("-4294967296 %s -4294967296 = %d, want 0", "-", r) 929 } 930 y = -1 931 r = x - y 932 if r != -4294967295 { 933 t.Errorf("-4294967296 %s -1 = %d, want -4294967295", "-", r) 934 } 935 y = 0 936 r = x - y 937 if r != -4294967296 { 938 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "-", r) 939 } 940 y = 1 941 r = x - y 942 if r != -4294967297 { 943 t.Errorf("-4294967296 %s 1 = %d, want -4294967297", "-", r) 944 } 945 y = 4294967296 946 r = x - y 947 if r != -8589934592 { 948 t.Errorf("-4294967296 %s 4294967296 = %d, want -8589934592", "-", r) 949 } 950 y = 9223372036854775806 951 r = x - y 952 if r != 9223372032559808514 { 953 t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 9223372032559808514", "-", r) 954 } 955 y = 9223372036854775807 956 r = x - y 957 if r != 9223372032559808513 { 958 t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 9223372032559808513", "-", r) 959 } 960 x = -1 961 y = -9223372036854775808 962 r = x - y 963 if r != 9223372036854775807 { 964 t.Errorf("-1 %s -9223372036854775808 = %d, want 9223372036854775807", "-", r) 965 } 966 y = -9223372036854775807 967 r = x - y 968 if r != 9223372036854775806 { 969 t.Errorf("-1 %s -9223372036854775807 = %d, want 9223372036854775806", "-", r) 970 } 971 y = -4294967296 972 r = x - y 973 if r != 4294967295 { 974 t.Errorf("-1 %s -4294967296 = %d, want 4294967295", "-", r) 975 } 976 y = -1 977 r = x - y 978 if r != 0 { 979 t.Errorf("-1 %s -1 = %d, want 0", "-", r) 980 } 981 y = 0 982 r = x - y 983 if r != -1 { 984 t.Errorf("-1 %s 0 = %d, want -1", "-", r) 985 } 986 y = 1 987 r = x - y 988 if r != -2 { 989 t.Errorf("-1 %s 1 = %d, want -2", "-", r) 990 } 991 y = 4294967296 992 r = x - y 993 if r != -4294967297 { 994 t.Errorf("-1 %s 4294967296 = %d, want -4294967297", "-", r) 995 } 996 y = 9223372036854775806 997 r = x - y 998 if r != -9223372036854775807 { 999 t.Errorf("-1 %s 9223372036854775806 = %d, want -9223372036854775807", "-", r) 1000 } 1001 y = 9223372036854775807 1002 r = x - y 1003 if r != -9223372036854775808 { 1004 t.Errorf("-1 %s 9223372036854775807 = %d, want -9223372036854775808", "-", r) 1005 } 1006 x = 0 1007 y = -9223372036854775808 1008 r = x - y 1009 if r != -9223372036854775808 { 1010 t.Errorf("0 %s -9223372036854775808 = %d, want -9223372036854775808", "-", r) 1011 } 1012 y = -9223372036854775807 1013 r = x - y 1014 if r != 9223372036854775807 { 1015 t.Errorf("0 %s -9223372036854775807 = %d, want 9223372036854775807", "-", r) 1016 } 1017 y = -4294967296 1018 r = x - y 1019 if r != 4294967296 { 1020 t.Errorf("0 %s -4294967296 = %d, want 4294967296", "-", r) 1021 } 1022 y = -1 1023 r = x - y 1024 if r != 1 { 1025 t.Errorf("0 %s -1 = %d, want 1", "-", r) 1026 } 1027 y = 0 1028 r = x - y 1029 if r != 0 { 1030 t.Errorf("0 %s 0 = %d, want 0", "-", r) 1031 } 1032 y = 1 1033 r = x - y 1034 if r != -1 { 1035 t.Errorf("0 %s 1 = %d, want -1", "-", r) 1036 } 1037 y = 4294967296 1038 r = x - y 1039 if r != -4294967296 { 1040 t.Errorf("0 %s 4294967296 = %d, want -4294967296", "-", r) 1041 } 1042 y = 9223372036854775806 1043 r = x - y 1044 if r != -9223372036854775806 { 1045 t.Errorf("0 %s 9223372036854775806 = %d, want -9223372036854775806", "-", r) 1046 } 1047 y = 9223372036854775807 1048 r = x - y 1049 if r != -9223372036854775807 { 1050 t.Errorf("0 %s 9223372036854775807 = %d, want -9223372036854775807", "-", r) 1051 } 1052 x = 1 1053 y = -9223372036854775808 1054 r = x - y 1055 if r != -9223372036854775807 { 1056 t.Errorf("1 %s -9223372036854775808 = %d, want -9223372036854775807", "-", r) 1057 } 1058 y = -9223372036854775807 1059 r = x - y 1060 if r != -9223372036854775808 { 1061 t.Errorf("1 %s -9223372036854775807 = %d, want -9223372036854775808", "-", r) 1062 } 1063 y = -4294967296 1064 r = x - y 1065 if r != 4294967297 { 1066 t.Errorf("1 %s -4294967296 = %d, want 4294967297", "-", r) 1067 } 1068 y = -1 1069 r = x - y 1070 if r != 2 { 1071 t.Errorf("1 %s -1 = %d, want 2", "-", r) 1072 } 1073 y = 0 1074 r = x - y 1075 if r != 1 { 1076 t.Errorf("1 %s 0 = %d, want 1", "-", r) 1077 } 1078 y = 1 1079 r = x - y 1080 if r != 0 { 1081 t.Errorf("1 %s 1 = %d, want 0", "-", r) 1082 } 1083 y = 4294967296 1084 r = x - y 1085 if r != -4294967295 { 1086 t.Errorf("1 %s 4294967296 = %d, want -4294967295", "-", r) 1087 } 1088 y = 9223372036854775806 1089 r = x - y 1090 if r != -9223372036854775805 { 1091 t.Errorf("1 %s 9223372036854775806 = %d, want -9223372036854775805", "-", r) 1092 } 1093 y = 9223372036854775807 1094 r = x - y 1095 if r != -9223372036854775806 { 1096 t.Errorf("1 %s 9223372036854775807 = %d, want -9223372036854775806", "-", r) 1097 } 1098 x = 4294967296 1099 y = -9223372036854775808 1100 r = x - y 1101 if r != -9223372032559808512 { 1102 t.Errorf("4294967296 %s -9223372036854775808 = %d, want -9223372032559808512", "-", r) 1103 } 1104 y = -9223372036854775807 1105 r = x - y 1106 if r != -9223372032559808513 { 1107 t.Errorf("4294967296 %s -9223372036854775807 = %d, want -9223372032559808513", "-", r) 1108 } 1109 y = -4294967296 1110 r = x - y 1111 if r != 8589934592 { 1112 t.Errorf("4294967296 %s -4294967296 = %d, want 8589934592", "-", r) 1113 } 1114 y = -1 1115 r = x - y 1116 if r != 4294967297 { 1117 t.Errorf("4294967296 %s -1 = %d, want 4294967297", "-", r) 1118 } 1119 y = 0 1120 r = x - y 1121 if r != 4294967296 { 1122 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "-", r) 1123 } 1124 y = 1 1125 r = x - y 1126 if r != 4294967295 { 1127 t.Errorf("4294967296 %s 1 = %d, want 4294967295", "-", r) 1128 } 1129 y = 4294967296 1130 r = x - y 1131 if r != 0 { 1132 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "-", r) 1133 } 1134 y = 9223372036854775806 1135 r = x - y 1136 if r != -9223372032559808510 { 1137 t.Errorf("4294967296 %s 9223372036854775806 = %d, want -9223372032559808510", "-", r) 1138 } 1139 y = 9223372036854775807 1140 r = x - y 1141 if r != -9223372032559808511 { 1142 t.Errorf("4294967296 %s 9223372036854775807 = %d, want -9223372032559808511", "-", r) 1143 } 1144 x = 9223372036854775806 1145 y = -9223372036854775808 1146 r = x - y 1147 if r != -2 { 1148 t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want -2", "-", r) 1149 } 1150 y = -9223372036854775807 1151 r = x - y 1152 if r != -3 { 1153 t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want -3", "-", r) 1154 } 1155 y = -4294967296 1156 r = x - y 1157 if r != -9223372032559808514 { 1158 t.Errorf("9223372036854775806 %s -4294967296 = %d, want -9223372032559808514", "-", r) 1159 } 1160 y = -1 1161 r = x - y 1162 if r != 9223372036854775807 { 1163 t.Errorf("9223372036854775806 %s -1 = %d, want 9223372036854775807", "-", r) 1164 } 1165 y = 0 1166 r = x - y 1167 if r != 9223372036854775806 { 1168 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "-", r) 1169 } 1170 y = 1 1171 r = x - y 1172 if r != 9223372036854775805 { 1173 t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775805", "-", r) 1174 } 1175 y = 4294967296 1176 r = x - y 1177 if r != 9223372032559808510 { 1178 t.Errorf("9223372036854775806 %s 4294967296 = %d, want 9223372032559808510", "-", r) 1179 } 1180 y = 9223372036854775806 1181 r = x - y 1182 if r != 0 { 1183 t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 0", "-", r) 1184 } 1185 y = 9223372036854775807 1186 r = x - y 1187 if r != -1 { 1188 t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want -1", "-", r) 1189 } 1190 x = 9223372036854775807 1191 y = -9223372036854775808 1192 r = x - y 1193 if r != -1 { 1194 t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want -1", "-", r) 1195 } 1196 y = -9223372036854775807 1197 r = x - y 1198 if r != -2 { 1199 t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want -2", "-", r) 1200 } 1201 y = -4294967296 1202 r = x - y 1203 if r != -9223372032559808513 { 1204 t.Errorf("9223372036854775807 %s -4294967296 = %d, want -9223372032559808513", "-", r) 1205 } 1206 y = -1 1207 r = x - y 1208 if r != -9223372036854775808 { 1209 t.Errorf("9223372036854775807 %s -1 = %d, want -9223372036854775808", "-", r) 1210 } 1211 y = 0 1212 r = x - y 1213 if r != 9223372036854775807 { 1214 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "-", r) 1215 } 1216 y = 1 1217 r = x - y 1218 if r != 9223372036854775806 { 1219 t.Errorf("9223372036854775807 %s 1 = %d, want 9223372036854775806", "-", r) 1220 } 1221 y = 4294967296 1222 r = x - y 1223 if r != 9223372032559808511 { 1224 t.Errorf("9223372036854775807 %s 4294967296 = %d, want 9223372032559808511", "-", r) 1225 } 1226 y = 9223372036854775806 1227 r = x - y 1228 if r != 1 { 1229 t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want 1", "-", r) 1230 } 1231 y = 9223372036854775807 1232 r = x - y 1233 if r != 0 { 1234 t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 0", "-", r) 1235 } 1236 } 1237 func TestConstFoldint64div(t *testing.T) { 1238 var x, y, r int64 1239 x = -9223372036854775808 1240 y = -9223372036854775808 1241 r = x / y 1242 if r != 1 { 1243 t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 1", "/", r) 1244 } 1245 y = -9223372036854775807 1246 r = x / y 1247 if r != 1 { 1248 t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want 1", "/", r) 1249 } 1250 y = -4294967296 1251 r = x / y 1252 if r != 2147483648 { 1253 t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 2147483648", "/", r) 1254 } 1255 y = -1 1256 r = x / y 1257 if r != -9223372036854775808 { 1258 t.Errorf("-9223372036854775808 %s -1 = %d, want -9223372036854775808", "/", r) 1259 } 1260 y = 1 1261 r = x / y 1262 if r != -9223372036854775808 { 1263 t.Errorf("-9223372036854775808 %s 1 = %d, want -9223372036854775808", "/", r) 1264 } 1265 y = 4294967296 1266 r = x / y 1267 if r != -2147483648 { 1268 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want -2147483648", "/", r) 1269 } 1270 y = 9223372036854775806 1271 r = x / y 1272 if r != -1 { 1273 t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want -1", "/", r) 1274 } 1275 y = 9223372036854775807 1276 r = x / y 1277 if r != -1 { 1278 t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -1", "/", r) 1279 } 1280 x = -9223372036854775807 1281 y = -9223372036854775808 1282 r = x / y 1283 if r != 0 { 1284 t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want 0", "/", r) 1285 } 1286 y = -9223372036854775807 1287 r = x / y 1288 if r != 1 { 1289 t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 1", "/", r) 1290 } 1291 y = -4294967296 1292 r = x / y 1293 if r != 2147483647 { 1294 t.Errorf("-9223372036854775807 %s -4294967296 = %d, want 2147483647", "/", r) 1295 } 1296 y = -1 1297 r = x / y 1298 if r != 9223372036854775807 { 1299 t.Errorf("-9223372036854775807 %s -1 = %d, want 9223372036854775807", "/", r) 1300 } 1301 y = 1 1302 r = x / y 1303 if r != -9223372036854775807 { 1304 t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775807", "/", r) 1305 } 1306 y = 4294967296 1307 r = x / y 1308 if r != -2147483647 { 1309 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -2147483647", "/", r) 1310 } 1311 y = 9223372036854775806 1312 r = x / y 1313 if r != -1 { 1314 t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want -1", "/", r) 1315 } 1316 y = 9223372036854775807 1317 r = x / y 1318 if r != -1 { 1319 t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want -1", "/", r) 1320 } 1321 x = -4294967296 1322 y = -9223372036854775808 1323 r = x / y 1324 if r != 0 { 1325 t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 0", "/", r) 1326 } 1327 y = -9223372036854775807 1328 r = x / y 1329 if r != 0 { 1330 t.Errorf("-4294967296 %s -9223372036854775807 = %d, want 0", "/", r) 1331 } 1332 y = -4294967296 1333 r = x / y 1334 if r != 1 { 1335 t.Errorf("-4294967296 %s -4294967296 = %d, want 1", "/", r) 1336 } 1337 y = -1 1338 r = x / y 1339 if r != 4294967296 { 1340 t.Errorf("-4294967296 %s -1 = %d, want 4294967296", "/", r) 1341 } 1342 y = 1 1343 r = x / y 1344 if r != -4294967296 { 1345 t.Errorf("-4294967296 %s 1 = %d, want -4294967296", "/", r) 1346 } 1347 y = 4294967296 1348 r = x / y 1349 if r != -1 { 1350 t.Errorf("-4294967296 %s 4294967296 = %d, want -1", "/", r) 1351 } 1352 y = 9223372036854775806 1353 r = x / y 1354 if r != 0 { 1355 t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 0", "/", r) 1356 } 1357 y = 9223372036854775807 1358 r = x / y 1359 if r != 0 { 1360 t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 0", "/", r) 1361 } 1362 x = -1 1363 y = -9223372036854775808 1364 r = x / y 1365 if r != 0 { 1366 t.Errorf("-1 %s -9223372036854775808 = %d, want 0", "/", r) 1367 } 1368 y = -9223372036854775807 1369 r = x / y 1370 if r != 0 { 1371 t.Errorf("-1 %s -9223372036854775807 = %d, want 0", "/", r) 1372 } 1373 y = -4294967296 1374 r = x / y 1375 if r != 0 { 1376 t.Errorf("-1 %s -4294967296 = %d, want 0", "/", r) 1377 } 1378 y = -1 1379 r = x / y 1380 if r != 1 { 1381 t.Errorf("-1 %s -1 = %d, want 1", "/", r) 1382 } 1383 y = 1 1384 r = x / y 1385 if r != -1 { 1386 t.Errorf("-1 %s 1 = %d, want -1", "/", r) 1387 } 1388 y = 4294967296 1389 r = x / y 1390 if r != 0 { 1391 t.Errorf("-1 %s 4294967296 = %d, want 0", "/", r) 1392 } 1393 y = 9223372036854775806 1394 r = x / y 1395 if r != 0 { 1396 t.Errorf("-1 %s 9223372036854775806 = %d, want 0", "/", r) 1397 } 1398 y = 9223372036854775807 1399 r = x / y 1400 if r != 0 { 1401 t.Errorf("-1 %s 9223372036854775807 = %d, want 0", "/", r) 1402 } 1403 x = 0 1404 y = -9223372036854775808 1405 r = x / y 1406 if r != 0 { 1407 t.Errorf("0 %s -9223372036854775808 = %d, want 0", "/", r) 1408 } 1409 y = -9223372036854775807 1410 r = x / y 1411 if r != 0 { 1412 t.Errorf("0 %s -9223372036854775807 = %d, want 0", "/", r) 1413 } 1414 y = -4294967296 1415 r = x / y 1416 if r != 0 { 1417 t.Errorf("0 %s -4294967296 = %d, want 0", "/", r) 1418 } 1419 y = -1 1420 r = x / y 1421 if r != 0 { 1422 t.Errorf("0 %s -1 = %d, want 0", "/", r) 1423 } 1424 y = 1 1425 r = x / y 1426 if r != 0 { 1427 t.Errorf("0 %s 1 = %d, want 0", "/", r) 1428 } 1429 y = 4294967296 1430 r = x / y 1431 if r != 0 { 1432 t.Errorf("0 %s 4294967296 = %d, want 0", "/", r) 1433 } 1434 y = 9223372036854775806 1435 r = x / y 1436 if r != 0 { 1437 t.Errorf("0 %s 9223372036854775806 = %d, want 0", "/", r) 1438 } 1439 y = 9223372036854775807 1440 r = x / y 1441 if r != 0 { 1442 t.Errorf("0 %s 9223372036854775807 = %d, want 0", "/", r) 1443 } 1444 x = 1 1445 y = -9223372036854775808 1446 r = x / y 1447 if r != 0 { 1448 t.Errorf("1 %s -9223372036854775808 = %d, want 0", "/", r) 1449 } 1450 y = -9223372036854775807 1451 r = x / y 1452 if r != 0 { 1453 t.Errorf("1 %s -9223372036854775807 = %d, want 0", "/", r) 1454 } 1455 y = -4294967296 1456 r = x / y 1457 if r != 0 { 1458 t.Errorf("1 %s -4294967296 = %d, want 0", "/", r) 1459 } 1460 y = -1 1461 r = x / y 1462 if r != -1 { 1463 t.Errorf("1 %s -1 = %d, want -1", "/", r) 1464 } 1465 y = 1 1466 r = x / y 1467 if r != 1 { 1468 t.Errorf("1 %s 1 = %d, want 1", "/", r) 1469 } 1470 y = 4294967296 1471 r = x / y 1472 if r != 0 { 1473 t.Errorf("1 %s 4294967296 = %d, want 0", "/", r) 1474 } 1475 y = 9223372036854775806 1476 r = x / y 1477 if r != 0 { 1478 t.Errorf("1 %s 9223372036854775806 = %d, want 0", "/", r) 1479 } 1480 y = 9223372036854775807 1481 r = x / y 1482 if r != 0 { 1483 t.Errorf("1 %s 9223372036854775807 = %d, want 0", "/", r) 1484 } 1485 x = 4294967296 1486 y = -9223372036854775808 1487 r = x / y 1488 if r != 0 { 1489 t.Errorf("4294967296 %s -9223372036854775808 = %d, want 0", "/", r) 1490 } 1491 y = -9223372036854775807 1492 r = x / y 1493 if r != 0 { 1494 t.Errorf("4294967296 %s -9223372036854775807 = %d, want 0", "/", r) 1495 } 1496 y = -4294967296 1497 r = x / y 1498 if r != -1 { 1499 t.Errorf("4294967296 %s -4294967296 = %d, want -1", "/", r) 1500 } 1501 y = -1 1502 r = x / y 1503 if r != -4294967296 { 1504 t.Errorf("4294967296 %s -1 = %d, want -4294967296", "/", r) 1505 } 1506 y = 1 1507 r = x / y 1508 if r != 4294967296 { 1509 t.Errorf("4294967296 %s 1 = %d, want 4294967296", "/", r) 1510 } 1511 y = 4294967296 1512 r = x / y 1513 if r != 1 { 1514 t.Errorf("4294967296 %s 4294967296 = %d, want 1", "/", r) 1515 } 1516 y = 9223372036854775806 1517 r = x / y 1518 if r != 0 { 1519 t.Errorf("4294967296 %s 9223372036854775806 = %d, want 0", "/", r) 1520 } 1521 y = 9223372036854775807 1522 r = x / y 1523 if r != 0 { 1524 t.Errorf("4294967296 %s 9223372036854775807 = %d, want 0", "/", r) 1525 } 1526 x = 9223372036854775806 1527 y = -9223372036854775808 1528 r = x / y 1529 if r != 0 { 1530 t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want 0", "/", r) 1531 } 1532 y = -9223372036854775807 1533 r = x / y 1534 if r != 0 { 1535 t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want 0", "/", r) 1536 } 1537 y = -4294967296 1538 r = x / y 1539 if r != -2147483647 { 1540 t.Errorf("9223372036854775806 %s -4294967296 = %d, want -2147483647", "/", r) 1541 } 1542 y = -1 1543 r = x / y 1544 if r != -9223372036854775806 { 1545 t.Errorf("9223372036854775806 %s -1 = %d, want -9223372036854775806", "/", r) 1546 } 1547 y = 1 1548 r = x / y 1549 if r != 9223372036854775806 { 1550 t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775806", "/", r) 1551 } 1552 y = 4294967296 1553 r = x / y 1554 if r != 2147483647 { 1555 t.Errorf("9223372036854775806 %s 4294967296 = %d, want 2147483647", "/", r) 1556 } 1557 y = 9223372036854775806 1558 r = x / y 1559 if r != 1 { 1560 t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 1", "/", r) 1561 } 1562 y = 9223372036854775807 1563 r = x / y 1564 if r != 0 { 1565 t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want 0", "/", r) 1566 } 1567 x = 9223372036854775807 1568 y = -9223372036854775808 1569 r = x / y 1570 if r != 0 { 1571 t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want 0", "/", r) 1572 } 1573 y = -9223372036854775807 1574 r = x / y 1575 if r != -1 { 1576 t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want -1", "/", r) 1577 } 1578 y = -4294967296 1579 r = x / y 1580 if r != -2147483647 { 1581 t.Errorf("9223372036854775807 %s -4294967296 = %d, want -2147483647", "/", r) 1582 } 1583 y = -1 1584 r = x / y 1585 if r != -9223372036854775807 { 1586 t.Errorf("9223372036854775807 %s -1 = %d, want -9223372036854775807", "/", r) 1587 } 1588 y = 1 1589 r = x / y 1590 if r != 9223372036854775807 { 1591 t.Errorf("9223372036854775807 %s 1 = %d, want 9223372036854775807", "/", r) 1592 } 1593 y = 4294967296 1594 r = x / y 1595 if r != 2147483647 { 1596 t.Errorf("9223372036854775807 %s 4294967296 = %d, want 2147483647", "/", r) 1597 } 1598 y = 9223372036854775806 1599 r = x / y 1600 if r != 1 { 1601 t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want 1", "/", r) 1602 } 1603 y = 9223372036854775807 1604 r = x / y 1605 if r != 1 { 1606 t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 1", "/", r) 1607 } 1608 } 1609 func TestConstFoldint64mul(t *testing.T) { 1610 var x, y, r int64 1611 x = -9223372036854775808 1612 y = -9223372036854775808 1613 r = x * y 1614 if r != 0 { 1615 t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "*", r) 1616 } 1617 y = -9223372036854775807 1618 r = x * y 1619 if r != -9223372036854775808 { 1620 t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want -9223372036854775808", "*", r) 1621 } 1622 y = -4294967296 1623 r = x * y 1624 if r != 0 { 1625 t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 0", "*", r) 1626 } 1627 y = -1 1628 r = x * y 1629 if r != -9223372036854775808 { 1630 t.Errorf("-9223372036854775808 %s -1 = %d, want -9223372036854775808", "*", r) 1631 } 1632 y = 0 1633 r = x * y 1634 if r != 0 { 1635 t.Errorf("-9223372036854775808 %s 0 = %d, want 0", "*", r) 1636 } 1637 y = 1 1638 r = x * y 1639 if r != -9223372036854775808 { 1640 t.Errorf("-9223372036854775808 %s 1 = %d, want -9223372036854775808", "*", r) 1641 } 1642 y = 4294967296 1643 r = x * y 1644 if r != 0 { 1645 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 0", "*", r) 1646 } 1647 y = 9223372036854775806 1648 r = x * y 1649 if r != 0 { 1650 t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want 0", "*", r) 1651 } 1652 y = 9223372036854775807 1653 r = x * y 1654 if r != -9223372036854775808 { 1655 t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -9223372036854775808", "*", r) 1656 } 1657 x = -9223372036854775807 1658 y = -9223372036854775808 1659 r = x * y 1660 if r != -9223372036854775808 { 1661 t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r) 1662 } 1663 y = -9223372036854775807 1664 r = x * y 1665 if r != 1 { 1666 t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 1", "*", r) 1667 } 1668 y = -4294967296 1669 r = x * y 1670 if r != -4294967296 { 1671 t.Errorf("-9223372036854775807 %s -4294967296 = %d, want -4294967296", "*", r) 1672 } 1673 y = -1 1674 r = x * y 1675 if r != 9223372036854775807 { 1676 t.Errorf("-9223372036854775807 %s -1 = %d, want 9223372036854775807", "*", r) 1677 } 1678 y = 0 1679 r = x * y 1680 if r != 0 { 1681 t.Errorf("-9223372036854775807 %s 0 = %d, want 0", "*", r) 1682 } 1683 y = 1 1684 r = x * y 1685 if r != -9223372036854775807 { 1686 t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775807", "*", r) 1687 } 1688 y = 4294967296 1689 r = x * y 1690 if r != 4294967296 { 1691 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want 4294967296", "*", r) 1692 } 1693 y = 9223372036854775806 1694 r = x * y 1695 if r != 9223372036854775806 { 1696 t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want 9223372036854775806", "*", r) 1697 } 1698 y = 9223372036854775807 1699 r = x * y 1700 if r != -1 { 1701 t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want -1", "*", r) 1702 } 1703 x = -4294967296 1704 y = -9223372036854775808 1705 r = x * y 1706 if r != 0 { 1707 t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 0", "*", r) 1708 } 1709 y = -9223372036854775807 1710 r = x * y 1711 if r != -4294967296 { 1712 t.Errorf("-4294967296 %s -9223372036854775807 = %d, want -4294967296", "*", r) 1713 } 1714 y = -4294967296 1715 r = x * y 1716 if r != 0 { 1717 t.Errorf("-4294967296 %s -4294967296 = %d, want 0", "*", r) 1718 } 1719 y = -1 1720 r = x * y 1721 if r != 4294967296 { 1722 t.Errorf("-4294967296 %s -1 = %d, want 4294967296", "*", r) 1723 } 1724 y = 0 1725 r = x * y 1726 if r != 0 { 1727 t.Errorf("-4294967296 %s 0 = %d, want 0", "*", r) 1728 } 1729 y = 1 1730 r = x * y 1731 if r != -4294967296 { 1732 t.Errorf("-4294967296 %s 1 = %d, want -4294967296", "*", r) 1733 } 1734 y = 4294967296 1735 r = x * y 1736 if r != 0 { 1737 t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "*", r) 1738 } 1739 y = 9223372036854775806 1740 r = x * y 1741 if r != 8589934592 { 1742 t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 8589934592", "*", r) 1743 } 1744 y = 9223372036854775807 1745 r = x * y 1746 if r != 4294967296 { 1747 t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 4294967296", "*", r) 1748 } 1749 x = -1 1750 y = -9223372036854775808 1751 r = x * y 1752 if r != -9223372036854775808 { 1753 t.Errorf("-1 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r) 1754 } 1755 y = -9223372036854775807 1756 r = x * y 1757 if r != 9223372036854775807 { 1758 t.Errorf("-1 %s -9223372036854775807 = %d, want 9223372036854775807", "*", r) 1759 } 1760 y = -4294967296 1761 r = x * y 1762 if r != 4294967296 { 1763 t.Errorf("-1 %s -4294967296 = %d, want 4294967296", "*", r) 1764 } 1765 y = -1 1766 r = x * y 1767 if r != 1 { 1768 t.Errorf("-1 %s -1 = %d, want 1", "*", r) 1769 } 1770 y = 0 1771 r = x * y 1772 if r != 0 { 1773 t.Errorf("-1 %s 0 = %d, want 0", "*", r) 1774 } 1775 y = 1 1776 r = x * y 1777 if r != -1 { 1778 t.Errorf("-1 %s 1 = %d, want -1", "*", r) 1779 } 1780 y = 4294967296 1781 r = x * y 1782 if r != -4294967296 { 1783 t.Errorf("-1 %s 4294967296 = %d, want -4294967296", "*", r) 1784 } 1785 y = 9223372036854775806 1786 r = x * y 1787 if r != -9223372036854775806 { 1788 t.Errorf("-1 %s 9223372036854775806 = %d, want -9223372036854775806", "*", r) 1789 } 1790 y = 9223372036854775807 1791 r = x * y 1792 if r != -9223372036854775807 { 1793 t.Errorf("-1 %s 9223372036854775807 = %d, want -9223372036854775807", "*", r) 1794 } 1795 x = 0 1796 y = -9223372036854775808 1797 r = x * y 1798 if r != 0 { 1799 t.Errorf("0 %s -9223372036854775808 = %d, want 0", "*", r) 1800 } 1801 y = -9223372036854775807 1802 r = x * y 1803 if r != 0 { 1804 t.Errorf("0 %s -9223372036854775807 = %d, want 0", "*", r) 1805 } 1806 y = -4294967296 1807 r = x * y 1808 if r != 0 { 1809 t.Errorf("0 %s -4294967296 = %d, want 0", "*", r) 1810 } 1811 y = -1 1812 r = x * y 1813 if r != 0 { 1814 t.Errorf("0 %s -1 = %d, want 0", "*", r) 1815 } 1816 y = 0 1817 r = x * y 1818 if r != 0 { 1819 t.Errorf("0 %s 0 = %d, want 0", "*", r) 1820 } 1821 y = 1 1822 r = x * y 1823 if r != 0 { 1824 t.Errorf("0 %s 1 = %d, want 0", "*", r) 1825 } 1826 y = 4294967296 1827 r = x * y 1828 if r != 0 { 1829 t.Errorf("0 %s 4294967296 = %d, want 0", "*", r) 1830 } 1831 y = 9223372036854775806 1832 r = x * y 1833 if r != 0 { 1834 t.Errorf("0 %s 9223372036854775806 = %d, want 0", "*", r) 1835 } 1836 y = 9223372036854775807 1837 r = x * y 1838 if r != 0 { 1839 t.Errorf("0 %s 9223372036854775807 = %d, want 0", "*", r) 1840 } 1841 x = 1 1842 y = -9223372036854775808 1843 r = x * y 1844 if r != -9223372036854775808 { 1845 t.Errorf("1 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r) 1846 } 1847 y = -9223372036854775807 1848 r = x * y 1849 if r != -9223372036854775807 { 1850 t.Errorf("1 %s -9223372036854775807 = %d, want -9223372036854775807", "*", r) 1851 } 1852 y = -4294967296 1853 r = x * y 1854 if r != -4294967296 { 1855 t.Errorf("1 %s -4294967296 = %d, want -4294967296", "*", r) 1856 } 1857 y = -1 1858 r = x * y 1859 if r != -1 { 1860 t.Errorf("1 %s -1 = %d, want -1", "*", r) 1861 } 1862 y = 0 1863 r = x * y 1864 if r != 0 { 1865 t.Errorf("1 %s 0 = %d, want 0", "*", r) 1866 } 1867 y = 1 1868 r = x * y 1869 if r != 1 { 1870 t.Errorf("1 %s 1 = %d, want 1", "*", r) 1871 } 1872 y = 4294967296 1873 r = x * y 1874 if r != 4294967296 { 1875 t.Errorf("1 %s 4294967296 = %d, want 4294967296", "*", r) 1876 } 1877 y = 9223372036854775806 1878 r = x * y 1879 if r != 9223372036854775806 { 1880 t.Errorf("1 %s 9223372036854775806 = %d, want 9223372036854775806", "*", r) 1881 } 1882 y = 9223372036854775807 1883 r = x * y 1884 if r != 9223372036854775807 { 1885 t.Errorf("1 %s 9223372036854775807 = %d, want 9223372036854775807", "*", r) 1886 } 1887 x = 4294967296 1888 y = -9223372036854775808 1889 r = x * y 1890 if r != 0 { 1891 t.Errorf("4294967296 %s -9223372036854775808 = %d, want 0", "*", r) 1892 } 1893 y = -9223372036854775807 1894 r = x * y 1895 if r != 4294967296 { 1896 t.Errorf("4294967296 %s -9223372036854775807 = %d, want 4294967296", "*", r) 1897 } 1898 y = -4294967296 1899 r = x * y 1900 if r != 0 { 1901 t.Errorf("4294967296 %s -4294967296 = %d, want 0", "*", r) 1902 } 1903 y = -1 1904 r = x * y 1905 if r != -4294967296 { 1906 t.Errorf("4294967296 %s -1 = %d, want -4294967296", "*", r) 1907 } 1908 y = 0 1909 r = x * y 1910 if r != 0 { 1911 t.Errorf("4294967296 %s 0 = %d, want 0", "*", r) 1912 } 1913 y = 1 1914 r = x * y 1915 if r != 4294967296 { 1916 t.Errorf("4294967296 %s 1 = %d, want 4294967296", "*", r) 1917 } 1918 y = 4294967296 1919 r = x * y 1920 if r != 0 { 1921 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "*", r) 1922 } 1923 y = 9223372036854775806 1924 r = x * y 1925 if r != -8589934592 { 1926 t.Errorf("4294967296 %s 9223372036854775806 = %d, want -8589934592", "*", r) 1927 } 1928 y = 9223372036854775807 1929 r = x * y 1930 if r != -4294967296 { 1931 t.Errorf("4294967296 %s 9223372036854775807 = %d, want -4294967296", "*", r) 1932 } 1933 x = 9223372036854775806 1934 y = -9223372036854775808 1935 r = x * y 1936 if r != 0 { 1937 t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want 0", "*", r) 1938 } 1939 y = -9223372036854775807 1940 r = x * y 1941 if r != 9223372036854775806 { 1942 t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want 9223372036854775806", "*", r) 1943 } 1944 y = -4294967296 1945 r = x * y 1946 if r != 8589934592 { 1947 t.Errorf("9223372036854775806 %s -4294967296 = %d, want 8589934592", "*", r) 1948 } 1949 y = -1 1950 r = x * y 1951 if r != -9223372036854775806 { 1952 t.Errorf("9223372036854775806 %s -1 = %d, want -9223372036854775806", "*", r) 1953 } 1954 y = 0 1955 r = x * y 1956 if r != 0 { 1957 t.Errorf("9223372036854775806 %s 0 = %d, want 0", "*", r) 1958 } 1959 y = 1 1960 r = x * y 1961 if r != 9223372036854775806 { 1962 t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775806", "*", r) 1963 } 1964 y = 4294967296 1965 r = x * y 1966 if r != -8589934592 { 1967 t.Errorf("9223372036854775806 %s 4294967296 = %d, want -8589934592", "*", r) 1968 } 1969 y = 9223372036854775806 1970 r = x * y 1971 if r != 4 { 1972 t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 4", "*", r) 1973 } 1974 y = 9223372036854775807 1975 r = x * y 1976 if r != -9223372036854775806 { 1977 t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want -9223372036854775806", "*", r) 1978 } 1979 x = 9223372036854775807 1980 y = -9223372036854775808 1981 r = x * y 1982 if r != -9223372036854775808 { 1983 t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r) 1984 } 1985 y = -9223372036854775807 1986 r = x * y 1987 if r != -1 { 1988 t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want -1", "*", r) 1989 } 1990 y = -4294967296 1991 r = x * y 1992 if r != 4294967296 { 1993 t.Errorf("9223372036854775807 %s -4294967296 = %d, want 4294967296", "*", r) 1994 } 1995 y = -1 1996 r = x * y 1997 if r != -9223372036854775807 { 1998 t.Errorf("9223372036854775807 %s -1 = %d, want -9223372036854775807", "*", r) 1999 } 2000 y = 0 2001 r = x * y 2002 if r != 0 { 2003 t.Errorf("9223372036854775807 %s 0 = %d, want 0", "*", r) 2004 } 2005 y = 1 2006 r = x * y 2007 if r != 9223372036854775807 { 2008 t.Errorf("9223372036854775807 %s 1 = %d, want 9223372036854775807", "*", r) 2009 } 2010 y = 4294967296 2011 r = x * y 2012 if r != -4294967296 { 2013 t.Errorf("9223372036854775807 %s 4294967296 = %d, want -4294967296", "*", r) 2014 } 2015 y = 9223372036854775806 2016 r = x * y 2017 if r != -9223372036854775806 { 2018 t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want -9223372036854775806", "*", r) 2019 } 2020 y = 9223372036854775807 2021 r = x * y 2022 if r != 1 { 2023 t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 1", "*", r) 2024 } 2025 } 2026 func TestConstFoldint64mod(t *testing.T) { 2027 var x, y, r int64 2028 x = -9223372036854775808 2029 y = -9223372036854775808 2030 r = x % y 2031 if r != 0 { 2032 t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "%", r) 2033 } 2034 y = -9223372036854775807 2035 r = x % y 2036 if r != -1 { 2037 t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want -1", "%", r) 2038 } 2039 y = -4294967296 2040 r = x % y 2041 if r != 0 { 2042 t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 0", "%", r) 2043 } 2044 y = -1 2045 r = x % y 2046 if r != 0 { 2047 t.Errorf("-9223372036854775808 %s -1 = %d, want 0", "%", r) 2048 } 2049 y = 1 2050 r = x % y 2051 if r != 0 { 2052 t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "%", r) 2053 } 2054 y = 4294967296 2055 r = x % y 2056 if r != 0 { 2057 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 0", "%", r) 2058 } 2059 y = 9223372036854775806 2060 r = x % y 2061 if r != -2 { 2062 t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want -2", "%", r) 2063 } 2064 y = 9223372036854775807 2065 r = x % y 2066 if r != -1 { 2067 t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -1", "%", r) 2068 } 2069 x = -9223372036854775807 2070 y = -9223372036854775808 2071 r = x % y 2072 if r != -9223372036854775807 { 2073 t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want -9223372036854775807", "%", r) 2074 } 2075 y = -9223372036854775807 2076 r = x % y 2077 if r != 0 { 2078 t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 0", "%", r) 2079 } 2080 y = -4294967296 2081 r = x % y 2082 if r != -4294967295 { 2083 t.Errorf("-9223372036854775807 %s -4294967296 = %d, want -4294967295", "%", r) 2084 } 2085 y = -1 2086 r = x % y 2087 if r != 0 { 2088 t.Errorf("-9223372036854775807 %s -1 = %d, want 0", "%", r) 2089 } 2090 y = 1 2091 r = x % y 2092 if r != 0 { 2093 t.Errorf("-9223372036854775807 %s 1 = %d, want 0", "%", r) 2094 } 2095 y = 4294967296 2096 r = x % y 2097 if r != -4294967295 { 2098 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -4294967295", "%", r) 2099 } 2100 y = 9223372036854775806 2101 r = x % y 2102 if r != -1 { 2103 t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want -1", "%", r) 2104 } 2105 y = 9223372036854775807 2106 r = x % y 2107 if r != 0 { 2108 t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want 0", "%", r) 2109 } 2110 x = -4294967296 2111 y = -9223372036854775808 2112 r = x % y 2113 if r != -4294967296 { 2114 t.Errorf("-4294967296 %s -9223372036854775808 = %d, want -4294967296", "%", r) 2115 } 2116 y = -9223372036854775807 2117 r = x % y 2118 if r != -4294967296 { 2119 t.Errorf("-4294967296 %s -9223372036854775807 = %d, want -4294967296", "%", r) 2120 } 2121 y = -4294967296 2122 r = x % y 2123 if r != 0 { 2124 t.Errorf("-4294967296 %s -4294967296 = %d, want 0", "%", r) 2125 } 2126 y = -1 2127 r = x % y 2128 if r != 0 { 2129 t.Errorf("-4294967296 %s -1 = %d, want 0", "%", r) 2130 } 2131 y = 1 2132 r = x % y 2133 if r != 0 { 2134 t.Errorf("-4294967296 %s 1 = %d, want 0", "%", r) 2135 } 2136 y = 4294967296 2137 r = x % y 2138 if r != 0 { 2139 t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "%", r) 2140 } 2141 y = 9223372036854775806 2142 r = x % y 2143 if r != -4294967296 { 2144 t.Errorf("-4294967296 %s 9223372036854775806 = %d, want -4294967296", "%", r) 2145 } 2146 y = 9223372036854775807 2147 r = x % y 2148 if r != -4294967296 { 2149 t.Errorf("-4294967296 %s 9223372036854775807 = %d, want -4294967296", "%", r) 2150 } 2151 x = -1 2152 y = -9223372036854775808 2153 r = x % y 2154 if r != -1 { 2155 t.Errorf("-1 %s -9223372036854775808 = %d, want -1", "%", r) 2156 } 2157 y = -9223372036854775807 2158 r = x % y 2159 if r != -1 { 2160 t.Errorf("-1 %s -9223372036854775807 = %d, want -1", "%", r) 2161 } 2162 y = -4294967296 2163 r = x % y 2164 if r != -1 { 2165 t.Errorf("-1 %s -4294967296 = %d, want -1", "%", r) 2166 } 2167 y = -1 2168 r = x % y 2169 if r != 0 { 2170 t.Errorf("-1 %s -1 = %d, want 0", "%", r) 2171 } 2172 y = 1 2173 r = x % y 2174 if r != 0 { 2175 t.Errorf("-1 %s 1 = %d, want 0", "%", r) 2176 } 2177 y = 4294967296 2178 r = x % y 2179 if r != -1 { 2180 t.Errorf("-1 %s 4294967296 = %d, want -1", "%", r) 2181 } 2182 y = 9223372036854775806 2183 r = x % y 2184 if r != -1 { 2185 t.Errorf("-1 %s 9223372036854775806 = %d, want -1", "%", r) 2186 } 2187 y = 9223372036854775807 2188 r = x % y 2189 if r != -1 { 2190 t.Errorf("-1 %s 9223372036854775807 = %d, want -1", "%", r) 2191 } 2192 x = 0 2193 y = -9223372036854775808 2194 r = x % y 2195 if r != 0 { 2196 t.Errorf("0 %s -9223372036854775808 = %d, want 0", "%", r) 2197 } 2198 y = -9223372036854775807 2199 r = x % y 2200 if r != 0 { 2201 t.Errorf("0 %s -9223372036854775807 = %d, want 0", "%", r) 2202 } 2203 y = -4294967296 2204 r = x % y 2205 if r != 0 { 2206 t.Errorf("0 %s -4294967296 = %d, want 0", "%", r) 2207 } 2208 y = -1 2209 r = x % y 2210 if r != 0 { 2211 t.Errorf("0 %s -1 = %d, want 0", "%", r) 2212 } 2213 y = 1 2214 r = x % y 2215 if r != 0 { 2216 t.Errorf("0 %s 1 = %d, want 0", "%", r) 2217 } 2218 y = 4294967296 2219 r = x % y 2220 if r != 0 { 2221 t.Errorf("0 %s 4294967296 = %d, want 0", "%", r) 2222 } 2223 y = 9223372036854775806 2224 r = x % y 2225 if r != 0 { 2226 t.Errorf("0 %s 9223372036854775806 = %d, want 0", "%", r) 2227 } 2228 y = 9223372036854775807 2229 r = x % y 2230 if r != 0 { 2231 t.Errorf("0 %s 9223372036854775807 = %d, want 0", "%", r) 2232 } 2233 x = 1 2234 y = -9223372036854775808 2235 r = x % y 2236 if r != 1 { 2237 t.Errorf("1 %s -9223372036854775808 = %d, want 1", "%", r) 2238 } 2239 y = -9223372036854775807 2240 r = x % y 2241 if r != 1 { 2242 t.Errorf("1 %s -9223372036854775807 = %d, want 1", "%", r) 2243 } 2244 y = -4294967296 2245 r = x % y 2246 if r != 1 { 2247 t.Errorf("1 %s -4294967296 = %d, want 1", "%", r) 2248 } 2249 y = -1 2250 r = x % y 2251 if r != 0 { 2252 t.Errorf("1 %s -1 = %d, want 0", "%", r) 2253 } 2254 y = 1 2255 r = x % y 2256 if r != 0 { 2257 t.Errorf("1 %s 1 = %d, want 0", "%", r) 2258 } 2259 y = 4294967296 2260 r = x % y 2261 if r != 1 { 2262 t.Errorf("1 %s 4294967296 = %d, want 1", "%", r) 2263 } 2264 y = 9223372036854775806 2265 r = x % y 2266 if r != 1 { 2267 t.Errorf("1 %s 9223372036854775806 = %d, want 1", "%", r) 2268 } 2269 y = 9223372036854775807 2270 r = x % y 2271 if r != 1 { 2272 t.Errorf("1 %s 9223372036854775807 = %d, want 1", "%", r) 2273 } 2274 x = 4294967296 2275 y = -9223372036854775808 2276 r = x % y 2277 if r != 4294967296 { 2278 t.Errorf("4294967296 %s -9223372036854775808 = %d, want 4294967296", "%", r) 2279 } 2280 y = -9223372036854775807 2281 r = x % y 2282 if r != 4294967296 { 2283 t.Errorf("4294967296 %s -9223372036854775807 = %d, want 4294967296", "%", r) 2284 } 2285 y = -4294967296 2286 r = x % y 2287 if r != 0 { 2288 t.Errorf("4294967296 %s -4294967296 = %d, want 0", "%", r) 2289 } 2290 y = -1 2291 r = x % y 2292 if r != 0 { 2293 t.Errorf("4294967296 %s -1 = %d, want 0", "%", r) 2294 } 2295 y = 1 2296 r = x % y 2297 if r != 0 { 2298 t.Errorf("4294967296 %s 1 = %d, want 0", "%", r) 2299 } 2300 y = 4294967296 2301 r = x % y 2302 if r != 0 { 2303 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "%", r) 2304 } 2305 y = 9223372036854775806 2306 r = x % y 2307 if r != 4294967296 { 2308 t.Errorf("4294967296 %s 9223372036854775806 = %d, want 4294967296", "%", r) 2309 } 2310 y = 9223372036854775807 2311 r = x % y 2312 if r != 4294967296 { 2313 t.Errorf("4294967296 %s 9223372036854775807 = %d, want 4294967296", "%", r) 2314 } 2315 x = 9223372036854775806 2316 y = -9223372036854775808 2317 r = x % y 2318 if r != 9223372036854775806 { 2319 t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want 9223372036854775806", "%", r) 2320 } 2321 y = -9223372036854775807 2322 r = x % y 2323 if r != 9223372036854775806 { 2324 t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want 9223372036854775806", "%", r) 2325 } 2326 y = -4294967296 2327 r = x % y 2328 if r != 4294967294 { 2329 t.Errorf("9223372036854775806 %s -4294967296 = %d, want 4294967294", "%", r) 2330 } 2331 y = -1 2332 r = x % y 2333 if r != 0 { 2334 t.Errorf("9223372036854775806 %s -1 = %d, want 0", "%", r) 2335 } 2336 y = 1 2337 r = x % y 2338 if r != 0 { 2339 t.Errorf("9223372036854775806 %s 1 = %d, want 0", "%", r) 2340 } 2341 y = 4294967296 2342 r = x % y 2343 if r != 4294967294 { 2344 t.Errorf("9223372036854775806 %s 4294967296 = %d, want 4294967294", "%", r) 2345 } 2346 y = 9223372036854775806 2347 r = x % y 2348 if r != 0 { 2349 t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 0", "%", r) 2350 } 2351 y = 9223372036854775807 2352 r = x % y 2353 if r != 9223372036854775806 { 2354 t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want 9223372036854775806", "%", r) 2355 } 2356 x = 9223372036854775807 2357 y = -9223372036854775808 2358 r = x % y 2359 if r != 9223372036854775807 { 2360 t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want 9223372036854775807", "%", r) 2361 } 2362 y = -9223372036854775807 2363 r = x % y 2364 if r != 0 { 2365 t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want 0", "%", r) 2366 } 2367 y = -4294967296 2368 r = x % y 2369 if r != 4294967295 { 2370 t.Errorf("9223372036854775807 %s -4294967296 = %d, want 4294967295", "%", r) 2371 } 2372 y = -1 2373 r = x % y 2374 if r != 0 { 2375 t.Errorf("9223372036854775807 %s -1 = %d, want 0", "%", r) 2376 } 2377 y = 1 2378 r = x % y 2379 if r != 0 { 2380 t.Errorf("9223372036854775807 %s 1 = %d, want 0", "%", r) 2381 } 2382 y = 4294967296 2383 r = x % y 2384 if r != 4294967295 { 2385 t.Errorf("9223372036854775807 %s 4294967296 = %d, want 4294967295", "%", r) 2386 } 2387 y = 9223372036854775806 2388 r = x % y 2389 if r != 1 { 2390 t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want 1", "%", r) 2391 } 2392 y = 9223372036854775807 2393 r = x % y 2394 if r != 0 { 2395 t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 0", "%", r) 2396 } 2397 } 2398 func TestConstFolduint32add(t *testing.T) { 2399 var x, y, r uint32 2400 x = 0 2401 y = 0 2402 r = x + y 2403 if r != 0 { 2404 t.Errorf("0 %s 0 = %d, want 0", "+", r) 2405 } 2406 y = 1 2407 r = x + y 2408 if r != 1 { 2409 t.Errorf("0 %s 1 = %d, want 1", "+", r) 2410 } 2411 y = 4294967295 2412 r = x + y 2413 if r != 4294967295 { 2414 t.Errorf("0 %s 4294967295 = %d, want 4294967295", "+", r) 2415 } 2416 x = 1 2417 y = 0 2418 r = x + y 2419 if r != 1 { 2420 t.Errorf("1 %s 0 = %d, want 1", "+", r) 2421 } 2422 y = 1 2423 r = x + y 2424 if r != 2 { 2425 t.Errorf("1 %s 1 = %d, want 2", "+", r) 2426 } 2427 y = 4294967295 2428 r = x + y 2429 if r != 0 { 2430 t.Errorf("1 %s 4294967295 = %d, want 0", "+", r) 2431 } 2432 x = 4294967295 2433 y = 0 2434 r = x + y 2435 if r != 4294967295 { 2436 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "+", r) 2437 } 2438 y = 1 2439 r = x + y 2440 if r != 0 { 2441 t.Errorf("4294967295 %s 1 = %d, want 0", "+", r) 2442 } 2443 y = 4294967295 2444 r = x + y 2445 if r != 4294967294 { 2446 t.Errorf("4294967295 %s 4294967295 = %d, want 4294967294", "+", r) 2447 } 2448 } 2449 func TestConstFolduint32sub(t *testing.T) { 2450 var x, y, r uint32 2451 x = 0 2452 y = 0 2453 r = x - y 2454 if r != 0 { 2455 t.Errorf("0 %s 0 = %d, want 0", "-", r) 2456 } 2457 y = 1 2458 r = x - y 2459 if r != 4294967295 { 2460 t.Errorf("0 %s 1 = %d, want 4294967295", "-", r) 2461 } 2462 y = 4294967295 2463 r = x - y 2464 if r != 1 { 2465 t.Errorf("0 %s 4294967295 = %d, want 1", "-", r) 2466 } 2467 x = 1 2468 y = 0 2469 r = x - y 2470 if r != 1 { 2471 t.Errorf("1 %s 0 = %d, want 1", "-", r) 2472 } 2473 y = 1 2474 r = x - y 2475 if r != 0 { 2476 t.Errorf("1 %s 1 = %d, want 0", "-", r) 2477 } 2478 y = 4294967295 2479 r = x - y 2480 if r != 2 { 2481 t.Errorf("1 %s 4294967295 = %d, want 2", "-", r) 2482 } 2483 x = 4294967295 2484 y = 0 2485 r = x - y 2486 if r != 4294967295 { 2487 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "-", r) 2488 } 2489 y = 1 2490 r = x - y 2491 if r != 4294967294 { 2492 t.Errorf("4294967295 %s 1 = %d, want 4294967294", "-", r) 2493 } 2494 y = 4294967295 2495 r = x - y 2496 if r != 0 { 2497 t.Errorf("4294967295 %s 4294967295 = %d, want 0", "-", r) 2498 } 2499 } 2500 func TestConstFolduint32div(t *testing.T) { 2501 var x, y, r uint32 2502 x = 0 2503 y = 1 2504 r = x / y 2505 if r != 0 { 2506 t.Errorf("0 %s 1 = %d, want 0", "/", r) 2507 } 2508 y = 4294967295 2509 r = x / y 2510 if r != 0 { 2511 t.Errorf("0 %s 4294967295 = %d, want 0", "/", r) 2512 } 2513 x = 1 2514 y = 1 2515 r = x / y 2516 if r != 1 { 2517 t.Errorf("1 %s 1 = %d, want 1", "/", r) 2518 } 2519 y = 4294967295 2520 r = x / y 2521 if r != 0 { 2522 t.Errorf("1 %s 4294967295 = %d, want 0", "/", r) 2523 } 2524 x = 4294967295 2525 y = 1 2526 r = x / y 2527 if r != 4294967295 { 2528 t.Errorf("4294967295 %s 1 = %d, want 4294967295", "/", r) 2529 } 2530 y = 4294967295 2531 r = x / y 2532 if r != 1 { 2533 t.Errorf("4294967295 %s 4294967295 = %d, want 1", "/", r) 2534 } 2535 } 2536 func TestConstFolduint32mul(t *testing.T) { 2537 var x, y, r uint32 2538 x = 0 2539 y = 0 2540 r = x * y 2541 if r != 0 { 2542 t.Errorf("0 %s 0 = %d, want 0", "*", r) 2543 } 2544 y = 1 2545 r = x * y 2546 if r != 0 { 2547 t.Errorf("0 %s 1 = %d, want 0", "*", r) 2548 } 2549 y = 4294967295 2550 r = x * y 2551 if r != 0 { 2552 t.Errorf("0 %s 4294967295 = %d, want 0", "*", r) 2553 } 2554 x = 1 2555 y = 0 2556 r = x * y 2557 if r != 0 { 2558 t.Errorf("1 %s 0 = %d, want 0", "*", r) 2559 } 2560 y = 1 2561 r = x * y 2562 if r != 1 { 2563 t.Errorf("1 %s 1 = %d, want 1", "*", r) 2564 } 2565 y = 4294967295 2566 r = x * y 2567 if r != 4294967295 { 2568 t.Errorf("1 %s 4294967295 = %d, want 4294967295", "*", r) 2569 } 2570 x = 4294967295 2571 y = 0 2572 r = x * y 2573 if r != 0 { 2574 t.Errorf("4294967295 %s 0 = %d, want 0", "*", r) 2575 } 2576 y = 1 2577 r = x * y 2578 if r != 4294967295 { 2579 t.Errorf("4294967295 %s 1 = %d, want 4294967295", "*", r) 2580 } 2581 y = 4294967295 2582 r = x * y 2583 if r != 1 { 2584 t.Errorf("4294967295 %s 4294967295 = %d, want 1", "*", r) 2585 } 2586 } 2587 func TestConstFolduint32mod(t *testing.T) { 2588 var x, y, r uint32 2589 x = 0 2590 y = 1 2591 r = x % y 2592 if r != 0 { 2593 t.Errorf("0 %s 1 = %d, want 0", "%", r) 2594 } 2595 y = 4294967295 2596 r = x % y 2597 if r != 0 { 2598 t.Errorf("0 %s 4294967295 = %d, want 0", "%", r) 2599 } 2600 x = 1 2601 y = 1 2602 r = x % y 2603 if r != 0 { 2604 t.Errorf("1 %s 1 = %d, want 0", "%", r) 2605 } 2606 y = 4294967295 2607 r = x % y 2608 if r != 1 { 2609 t.Errorf("1 %s 4294967295 = %d, want 1", "%", r) 2610 } 2611 x = 4294967295 2612 y = 1 2613 r = x % y 2614 if r != 0 { 2615 t.Errorf("4294967295 %s 1 = %d, want 0", "%", r) 2616 } 2617 y = 4294967295 2618 r = x % y 2619 if r != 0 { 2620 t.Errorf("4294967295 %s 4294967295 = %d, want 0", "%", r) 2621 } 2622 } 2623 func TestConstFoldint32add(t *testing.T) { 2624 var x, y, r int32 2625 x = -2147483648 2626 y = -2147483648 2627 r = x + y 2628 if r != 0 { 2629 t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "+", r) 2630 } 2631 y = -2147483647 2632 r = x + y 2633 if r != 1 { 2634 t.Errorf("-2147483648 %s -2147483647 = %d, want 1", "+", r) 2635 } 2636 y = -1 2637 r = x + y 2638 if r != 2147483647 { 2639 t.Errorf("-2147483648 %s -1 = %d, want 2147483647", "+", r) 2640 } 2641 y = 0 2642 r = x + y 2643 if r != -2147483648 { 2644 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "+", r) 2645 } 2646 y = 1 2647 r = x + y 2648 if r != -2147483647 { 2649 t.Errorf("-2147483648 %s 1 = %d, want -2147483647", "+", r) 2650 } 2651 y = 2147483647 2652 r = x + y 2653 if r != -1 { 2654 t.Errorf("-2147483648 %s 2147483647 = %d, want -1", "+", r) 2655 } 2656 x = -2147483647 2657 y = -2147483648 2658 r = x + y 2659 if r != 1 { 2660 t.Errorf("-2147483647 %s -2147483648 = %d, want 1", "+", r) 2661 } 2662 y = -2147483647 2663 r = x + y 2664 if r != 2 { 2665 t.Errorf("-2147483647 %s -2147483647 = %d, want 2", "+", r) 2666 } 2667 y = -1 2668 r = x + y 2669 if r != -2147483648 { 2670 t.Errorf("-2147483647 %s -1 = %d, want -2147483648", "+", r) 2671 } 2672 y = 0 2673 r = x + y 2674 if r != -2147483647 { 2675 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "+", r) 2676 } 2677 y = 1 2678 r = x + y 2679 if r != -2147483646 { 2680 t.Errorf("-2147483647 %s 1 = %d, want -2147483646", "+", r) 2681 } 2682 y = 2147483647 2683 r = x + y 2684 if r != 0 { 2685 t.Errorf("-2147483647 %s 2147483647 = %d, want 0", "+", r) 2686 } 2687 x = -1 2688 y = -2147483648 2689 r = x + y 2690 if r != 2147483647 { 2691 t.Errorf("-1 %s -2147483648 = %d, want 2147483647", "+", r) 2692 } 2693 y = -2147483647 2694 r = x + y 2695 if r != -2147483648 { 2696 t.Errorf("-1 %s -2147483647 = %d, want -2147483648", "+", r) 2697 } 2698 y = -1 2699 r = x + y 2700 if r != -2 { 2701 t.Errorf("-1 %s -1 = %d, want -2", "+", r) 2702 } 2703 y = 0 2704 r = x + y 2705 if r != -1 { 2706 t.Errorf("-1 %s 0 = %d, want -1", "+", r) 2707 } 2708 y = 1 2709 r = x + y 2710 if r != 0 { 2711 t.Errorf("-1 %s 1 = %d, want 0", "+", r) 2712 } 2713 y = 2147483647 2714 r = x + y 2715 if r != 2147483646 { 2716 t.Errorf("-1 %s 2147483647 = %d, want 2147483646", "+", r) 2717 } 2718 x = 0 2719 y = -2147483648 2720 r = x + y 2721 if r != -2147483648 { 2722 t.Errorf("0 %s -2147483648 = %d, want -2147483648", "+", r) 2723 } 2724 y = -2147483647 2725 r = x + y 2726 if r != -2147483647 { 2727 t.Errorf("0 %s -2147483647 = %d, want -2147483647", "+", r) 2728 } 2729 y = -1 2730 r = x + y 2731 if r != -1 { 2732 t.Errorf("0 %s -1 = %d, want -1", "+", r) 2733 } 2734 y = 0 2735 r = x + y 2736 if r != 0 { 2737 t.Errorf("0 %s 0 = %d, want 0", "+", r) 2738 } 2739 y = 1 2740 r = x + y 2741 if r != 1 { 2742 t.Errorf("0 %s 1 = %d, want 1", "+", r) 2743 } 2744 y = 2147483647 2745 r = x + y 2746 if r != 2147483647 { 2747 t.Errorf("0 %s 2147483647 = %d, want 2147483647", "+", r) 2748 } 2749 x = 1 2750 y = -2147483648 2751 r = x + y 2752 if r != -2147483647 { 2753 t.Errorf("1 %s -2147483648 = %d, want -2147483647", "+", r) 2754 } 2755 y = -2147483647 2756 r = x + y 2757 if r != -2147483646 { 2758 t.Errorf("1 %s -2147483647 = %d, want -2147483646", "+", r) 2759 } 2760 y = -1 2761 r = x + y 2762 if r != 0 { 2763 t.Errorf("1 %s -1 = %d, want 0", "+", r) 2764 } 2765 y = 0 2766 r = x + y 2767 if r != 1 { 2768 t.Errorf("1 %s 0 = %d, want 1", "+", r) 2769 } 2770 y = 1 2771 r = x + y 2772 if r != 2 { 2773 t.Errorf("1 %s 1 = %d, want 2", "+", r) 2774 } 2775 y = 2147483647 2776 r = x + y 2777 if r != -2147483648 { 2778 t.Errorf("1 %s 2147483647 = %d, want -2147483648", "+", r) 2779 } 2780 x = 2147483647 2781 y = -2147483648 2782 r = x + y 2783 if r != -1 { 2784 t.Errorf("2147483647 %s -2147483648 = %d, want -1", "+", r) 2785 } 2786 y = -2147483647 2787 r = x + y 2788 if r != 0 { 2789 t.Errorf("2147483647 %s -2147483647 = %d, want 0", "+", r) 2790 } 2791 y = -1 2792 r = x + y 2793 if r != 2147483646 { 2794 t.Errorf("2147483647 %s -1 = %d, want 2147483646", "+", r) 2795 } 2796 y = 0 2797 r = x + y 2798 if r != 2147483647 { 2799 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "+", r) 2800 } 2801 y = 1 2802 r = x + y 2803 if r != -2147483648 { 2804 t.Errorf("2147483647 %s 1 = %d, want -2147483648", "+", r) 2805 } 2806 y = 2147483647 2807 r = x + y 2808 if r != -2 { 2809 t.Errorf("2147483647 %s 2147483647 = %d, want -2", "+", r) 2810 } 2811 } 2812 func TestConstFoldint32sub(t *testing.T) { 2813 var x, y, r int32 2814 x = -2147483648 2815 y = -2147483648 2816 r = x - y 2817 if r != 0 { 2818 t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "-", r) 2819 } 2820 y = -2147483647 2821 r = x - y 2822 if r != -1 { 2823 t.Errorf("-2147483648 %s -2147483647 = %d, want -1", "-", r) 2824 } 2825 y = -1 2826 r = x - y 2827 if r != -2147483647 { 2828 t.Errorf("-2147483648 %s -1 = %d, want -2147483647", "-", r) 2829 } 2830 y = 0 2831 r = x - y 2832 if r != -2147483648 { 2833 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "-", r) 2834 } 2835 y = 1 2836 r = x - y 2837 if r != 2147483647 { 2838 t.Errorf("-2147483648 %s 1 = %d, want 2147483647", "-", r) 2839 } 2840 y = 2147483647 2841 r = x - y 2842 if r != 1 { 2843 t.Errorf("-2147483648 %s 2147483647 = %d, want 1", "-", r) 2844 } 2845 x = -2147483647 2846 y = -2147483648 2847 r = x - y 2848 if r != 1 { 2849 t.Errorf("-2147483647 %s -2147483648 = %d, want 1", "-", r) 2850 } 2851 y = -2147483647 2852 r = x - y 2853 if r != 0 { 2854 t.Errorf("-2147483647 %s -2147483647 = %d, want 0", "-", r) 2855 } 2856 y = -1 2857 r = x - y 2858 if r != -2147483646 { 2859 t.Errorf("-2147483647 %s -1 = %d, want -2147483646", "-", r) 2860 } 2861 y = 0 2862 r = x - y 2863 if r != -2147483647 { 2864 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "-", r) 2865 } 2866 y = 1 2867 r = x - y 2868 if r != -2147483648 { 2869 t.Errorf("-2147483647 %s 1 = %d, want -2147483648", "-", r) 2870 } 2871 y = 2147483647 2872 r = x - y 2873 if r != 2 { 2874 t.Errorf("-2147483647 %s 2147483647 = %d, want 2", "-", r) 2875 } 2876 x = -1 2877 y = -2147483648 2878 r = x - y 2879 if r != 2147483647 { 2880 t.Errorf("-1 %s -2147483648 = %d, want 2147483647", "-", r) 2881 } 2882 y = -2147483647 2883 r = x - y 2884 if r != 2147483646 { 2885 t.Errorf("-1 %s -2147483647 = %d, want 2147483646", "-", r) 2886 } 2887 y = -1 2888 r = x - y 2889 if r != 0 { 2890 t.Errorf("-1 %s -1 = %d, want 0", "-", r) 2891 } 2892 y = 0 2893 r = x - y 2894 if r != -1 { 2895 t.Errorf("-1 %s 0 = %d, want -1", "-", r) 2896 } 2897 y = 1 2898 r = x - y 2899 if r != -2 { 2900 t.Errorf("-1 %s 1 = %d, want -2", "-", r) 2901 } 2902 y = 2147483647 2903 r = x - y 2904 if r != -2147483648 { 2905 t.Errorf("-1 %s 2147483647 = %d, want -2147483648", "-", r) 2906 } 2907 x = 0 2908 y = -2147483648 2909 r = x - y 2910 if r != -2147483648 { 2911 t.Errorf("0 %s -2147483648 = %d, want -2147483648", "-", r) 2912 } 2913 y = -2147483647 2914 r = x - y 2915 if r != 2147483647 { 2916 t.Errorf("0 %s -2147483647 = %d, want 2147483647", "-", r) 2917 } 2918 y = -1 2919 r = x - y 2920 if r != 1 { 2921 t.Errorf("0 %s -1 = %d, want 1", "-", r) 2922 } 2923 y = 0 2924 r = x - y 2925 if r != 0 { 2926 t.Errorf("0 %s 0 = %d, want 0", "-", r) 2927 } 2928 y = 1 2929 r = x - y 2930 if r != -1 { 2931 t.Errorf("0 %s 1 = %d, want -1", "-", r) 2932 } 2933 y = 2147483647 2934 r = x - y 2935 if r != -2147483647 { 2936 t.Errorf("0 %s 2147483647 = %d, want -2147483647", "-", r) 2937 } 2938 x = 1 2939 y = -2147483648 2940 r = x - y 2941 if r != -2147483647 { 2942 t.Errorf("1 %s -2147483648 = %d, want -2147483647", "-", r) 2943 } 2944 y = -2147483647 2945 r = x - y 2946 if r != -2147483648 { 2947 t.Errorf("1 %s -2147483647 = %d, want -2147483648", "-", r) 2948 } 2949 y = -1 2950 r = x - y 2951 if r != 2 { 2952 t.Errorf("1 %s -1 = %d, want 2", "-", r) 2953 } 2954 y = 0 2955 r = x - y 2956 if r != 1 { 2957 t.Errorf("1 %s 0 = %d, want 1", "-", r) 2958 } 2959 y = 1 2960 r = x - y 2961 if r != 0 { 2962 t.Errorf("1 %s 1 = %d, want 0", "-", r) 2963 } 2964 y = 2147483647 2965 r = x - y 2966 if r != -2147483646 { 2967 t.Errorf("1 %s 2147483647 = %d, want -2147483646", "-", r) 2968 } 2969 x = 2147483647 2970 y = -2147483648 2971 r = x - y 2972 if r != -1 { 2973 t.Errorf("2147483647 %s -2147483648 = %d, want -1", "-", r) 2974 } 2975 y = -2147483647 2976 r = x - y 2977 if r != -2 { 2978 t.Errorf("2147483647 %s -2147483647 = %d, want -2", "-", r) 2979 } 2980 y = -1 2981 r = x - y 2982 if r != -2147483648 { 2983 t.Errorf("2147483647 %s -1 = %d, want -2147483648", "-", r) 2984 } 2985 y = 0 2986 r = x - y 2987 if r != 2147483647 { 2988 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "-", r) 2989 } 2990 y = 1 2991 r = x - y 2992 if r != 2147483646 { 2993 t.Errorf("2147483647 %s 1 = %d, want 2147483646", "-", r) 2994 } 2995 y = 2147483647 2996 r = x - y 2997 if r != 0 { 2998 t.Errorf("2147483647 %s 2147483647 = %d, want 0", "-", r) 2999 } 3000 } 3001 func TestConstFoldint32div(t *testing.T) { 3002 var x, y, r int32 3003 x = -2147483648 3004 y = -2147483648 3005 r = x / y 3006 if r != 1 { 3007 t.Errorf("-2147483648 %s -2147483648 = %d, want 1", "/", r) 3008 } 3009 y = -2147483647 3010 r = x / y 3011 if r != 1 { 3012 t.Errorf("-2147483648 %s -2147483647 = %d, want 1", "/", r) 3013 } 3014 y = -1 3015 r = x / y 3016 if r != -2147483648 { 3017 t.Errorf("-2147483648 %s -1 = %d, want -2147483648", "/", r) 3018 } 3019 y = 1 3020 r = x / y 3021 if r != -2147483648 { 3022 t.Errorf("-2147483648 %s 1 = %d, want -2147483648", "/", r) 3023 } 3024 y = 2147483647 3025 r = x / y 3026 if r != -1 { 3027 t.Errorf("-2147483648 %s 2147483647 = %d, want -1", "/", r) 3028 } 3029 x = -2147483647 3030 y = -2147483648 3031 r = x / y 3032 if r != 0 { 3033 t.Errorf("-2147483647 %s -2147483648 = %d, want 0", "/", r) 3034 } 3035 y = -2147483647 3036 r = x / y 3037 if r != 1 { 3038 t.Errorf("-2147483647 %s -2147483647 = %d, want 1", "/", r) 3039 } 3040 y = -1 3041 r = x / y 3042 if r != 2147483647 { 3043 t.Errorf("-2147483647 %s -1 = %d, want 2147483647", "/", r) 3044 } 3045 y = 1 3046 r = x / y 3047 if r != -2147483647 { 3048 t.Errorf("-2147483647 %s 1 = %d, want -2147483647", "/", r) 3049 } 3050 y = 2147483647 3051 r = x / y 3052 if r != -1 { 3053 t.Errorf("-2147483647 %s 2147483647 = %d, want -1", "/", r) 3054 } 3055 x = -1 3056 y = -2147483648 3057 r = x / y 3058 if r != 0 { 3059 t.Errorf("-1 %s -2147483648 = %d, want 0", "/", r) 3060 } 3061 y = -2147483647 3062 r = x / y 3063 if r != 0 { 3064 t.Errorf("-1 %s -2147483647 = %d, want 0", "/", r) 3065 } 3066 y = -1 3067 r = x / y 3068 if r != 1 { 3069 t.Errorf("-1 %s -1 = %d, want 1", "/", r) 3070 } 3071 y = 1 3072 r = x / y 3073 if r != -1 { 3074 t.Errorf("-1 %s 1 = %d, want -1", "/", r) 3075 } 3076 y = 2147483647 3077 r = x / y 3078 if r != 0 { 3079 t.Errorf("-1 %s 2147483647 = %d, want 0", "/", r) 3080 } 3081 x = 0 3082 y = -2147483648 3083 r = x / y 3084 if r != 0 { 3085 t.Errorf("0 %s -2147483648 = %d, want 0", "/", r) 3086 } 3087 y = -2147483647 3088 r = x / y 3089 if r != 0 { 3090 t.Errorf("0 %s -2147483647 = %d, want 0", "/", r) 3091 } 3092 y = -1 3093 r = x / y 3094 if r != 0 { 3095 t.Errorf("0 %s -1 = %d, want 0", "/", r) 3096 } 3097 y = 1 3098 r = x / y 3099 if r != 0 { 3100 t.Errorf("0 %s 1 = %d, want 0", "/", r) 3101 } 3102 y = 2147483647 3103 r = x / y 3104 if r != 0 { 3105 t.Errorf("0 %s 2147483647 = %d, want 0", "/", r) 3106 } 3107 x = 1 3108 y = -2147483648 3109 r = x / y 3110 if r != 0 { 3111 t.Errorf("1 %s -2147483648 = %d, want 0", "/", r) 3112 } 3113 y = -2147483647 3114 r = x / y 3115 if r != 0 { 3116 t.Errorf("1 %s -2147483647 = %d, want 0", "/", r) 3117 } 3118 y = -1 3119 r = x / y 3120 if r != -1 { 3121 t.Errorf("1 %s -1 = %d, want -1", "/", r) 3122 } 3123 y = 1 3124 r = x / y 3125 if r != 1 { 3126 t.Errorf("1 %s 1 = %d, want 1", "/", r) 3127 } 3128 y = 2147483647 3129 r = x / y 3130 if r != 0 { 3131 t.Errorf("1 %s 2147483647 = %d, want 0", "/", r) 3132 } 3133 x = 2147483647 3134 y = -2147483648 3135 r = x / y 3136 if r != 0 { 3137 t.Errorf("2147483647 %s -2147483648 = %d, want 0", "/", r) 3138 } 3139 y = -2147483647 3140 r = x / y 3141 if r != -1 { 3142 t.Errorf("2147483647 %s -2147483647 = %d, want -1", "/", r) 3143 } 3144 y = -1 3145 r = x / y 3146 if r != -2147483647 { 3147 t.Errorf("2147483647 %s -1 = %d, want -2147483647", "/", r) 3148 } 3149 y = 1 3150 r = x / y 3151 if r != 2147483647 { 3152 t.Errorf("2147483647 %s 1 = %d, want 2147483647", "/", r) 3153 } 3154 y = 2147483647 3155 r = x / y 3156 if r != 1 { 3157 t.Errorf("2147483647 %s 2147483647 = %d, want 1", "/", r) 3158 } 3159 } 3160 func TestConstFoldint32mul(t *testing.T) { 3161 var x, y, r int32 3162 x = -2147483648 3163 y = -2147483648 3164 r = x * y 3165 if r != 0 { 3166 t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "*", r) 3167 } 3168 y = -2147483647 3169 r = x * y 3170 if r != -2147483648 { 3171 t.Errorf("-2147483648 %s -2147483647 = %d, want -2147483648", "*", r) 3172 } 3173 y = -1 3174 r = x * y 3175 if r != -2147483648 { 3176 t.Errorf("-2147483648 %s -1 = %d, want -2147483648", "*", r) 3177 } 3178 y = 0 3179 r = x * y 3180 if r != 0 { 3181 t.Errorf("-2147483648 %s 0 = %d, want 0", "*", r) 3182 } 3183 y = 1 3184 r = x * y 3185 if r != -2147483648 { 3186 t.Errorf("-2147483648 %s 1 = %d, want -2147483648", "*", r) 3187 } 3188 y = 2147483647 3189 r = x * y 3190 if r != -2147483648 { 3191 t.Errorf("-2147483648 %s 2147483647 = %d, want -2147483648", "*", r) 3192 } 3193 x = -2147483647 3194 y = -2147483648 3195 r = x * y 3196 if r != -2147483648 { 3197 t.Errorf("-2147483647 %s -2147483648 = %d, want -2147483648", "*", r) 3198 } 3199 y = -2147483647 3200 r = x * y 3201 if r != 1 { 3202 t.Errorf("-2147483647 %s -2147483647 = %d, want 1", "*", r) 3203 } 3204 y = -1 3205 r = x * y 3206 if r != 2147483647 { 3207 t.Errorf("-2147483647 %s -1 = %d, want 2147483647", "*", r) 3208 } 3209 y = 0 3210 r = x * y 3211 if r != 0 { 3212 t.Errorf("-2147483647 %s 0 = %d, want 0", "*", r) 3213 } 3214 y = 1 3215 r = x * y 3216 if r != -2147483647 { 3217 t.Errorf("-2147483647 %s 1 = %d, want -2147483647", "*", r) 3218 } 3219 y = 2147483647 3220 r = x * y 3221 if r != -1 { 3222 t.Errorf("-2147483647 %s 2147483647 = %d, want -1", "*", r) 3223 } 3224 x = -1 3225 y = -2147483648 3226 r = x * y 3227 if r != -2147483648 { 3228 t.Errorf("-1 %s -2147483648 = %d, want -2147483648", "*", r) 3229 } 3230 y = -2147483647 3231 r = x * y 3232 if r != 2147483647 { 3233 t.Errorf("-1 %s -2147483647 = %d, want 2147483647", "*", r) 3234 } 3235 y = -1 3236 r = x * y 3237 if r != 1 { 3238 t.Errorf("-1 %s -1 = %d, want 1", "*", r) 3239 } 3240 y = 0 3241 r = x * y 3242 if r != 0 { 3243 t.Errorf("-1 %s 0 = %d, want 0", "*", r) 3244 } 3245 y = 1 3246 r = x * y 3247 if r != -1 { 3248 t.Errorf("-1 %s 1 = %d, want -1", "*", r) 3249 } 3250 y = 2147483647 3251 r = x * y 3252 if r != -2147483647 { 3253 t.Errorf("-1 %s 2147483647 = %d, want -2147483647", "*", r) 3254 } 3255 x = 0 3256 y = -2147483648 3257 r = x * y 3258 if r != 0 { 3259 t.Errorf("0 %s -2147483648 = %d, want 0", "*", r) 3260 } 3261 y = -2147483647 3262 r = x * y 3263 if r != 0 { 3264 t.Errorf("0 %s -2147483647 = %d, want 0", "*", r) 3265 } 3266 y = -1 3267 r = x * y 3268 if r != 0 { 3269 t.Errorf("0 %s -1 = %d, want 0", "*", r) 3270 } 3271 y = 0 3272 r = x * y 3273 if r != 0 { 3274 t.Errorf("0 %s 0 = %d, want 0", "*", r) 3275 } 3276 y = 1 3277 r = x * y 3278 if r != 0 { 3279 t.Errorf("0 %s 1 = %d, want 0", "*", r) 3280 } 3281 y = 2147483647 3282 r = x * y 3283 if r != 0 { 3284 t.Errorf("0 %s 2147483647 = %d, want 0", "*", r) 3285 } 3286 x = 1 3287 y = -2147483648 3288 r = x * y 3289 if r != -2147483648 { 3290 t.Errorf("1 %s -2147483648 = %d, want -2147483648", "*", r) 3291 } 3292 y = -2147483647 3293 r = x * y 3294 if r != -2147483647 { 3295 t.Errorf("1 %s -2147483647 = %d, want -2147483647", "*", r) 3296 } 3297 y = -1 3298 r = x * y 3299 if r != -1 { 3300 t.Errorf("1 %s -1 = %d, want -1", "*", r) 3301 } 3302 y = 0 3303 r = x * y 3304 if r != 0 { 3305 t.Errorf("1 %s 0 = %d, want 0", "*", r) 3306 } 3307 y = 1 3308 r = x * y 3309 if r != 1 { 3310 t.Errorf("1 %s 1 = %d, want 1", "*", r) 3311 } 3312 y = 2147483647 3313 r = x * y 3314 if r != 2147483647 { 3315 t.Errorf("1 %s 2147483647 = %d, want 2147483647", "*", r) 3316 } 3317 x = 2147483647 3318 y = -2147483648 3319 r = x * y 3320 if r != -2147483648 { 3321 t.Errorf("2147483647 %s -2147483648 = %d, want -2147483648", "*", r) 3322 } 3323 y = -2147483647 3324 r = x * y 3325 if r != -1 { 3326 t.Errorf("2147483647 %s -2147483647 = %d, want -1", "*", r) 3327 } 3328 y = -1 3329 r = x * y 3330 if r != -2147483647 { 3331 t.Errorf("2147483647 %s -1 = %d, want -2147483647", "*", r) 3332 } 3333 y = 0 3334 r = x * y 3335 if r != 0 { 3336 t.Errorf("2147483647 %s 0 = %d, want 0", "*", r) 3337 } 3338 y = 1 3339 r = x * y 3340 if r != 2147483647 { 3341 t.Errorf("2147483647 %s 1 = %d, want 2147483647", "*", r) 3342 } 3343 y = 2147483647 3344 r = x * y 3345 if r != 1 { 3346 t.Errorf("2147483647 %s 2147483647 = %d, want 1", "*", r) 3347 } 3348 } 3349 func TestConstFoldint32mod(t *testing.T) { 3350 var x, y, r int32 3351 x = -2147483648 3352 y = -2147483648 3353 r = x % y 3354 if r != 0 { 3355 t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "%", r) 3356 } 3357 y = -2147483647 3358 r = x % y 3359 if r != -1 { 3360 t.Errorf("-2147483648 %s -2147483647 = %d, want -1", "%", r) 3361 } 3362 y = -1 3363 r = x % y 3364 if r != 0 { 3365 t.Errorf("-2147483648 %s -1 = %d, want 0", "%", r) 3366 } 3367 y = 1 3368 r = x % y 3369 if r != 0 { 3370 t.Errorf("-2147483648 %s 1 = %d, want 0", "%", r) 3371 } 3372 y = 2147483647 3373 r = x % y 3374 if r != -1 { 3375 t.Errorf("-2147483648 %s 2147483647 = %d, want -1", "%", r) 3376 } 3377 x = -2147483647 3378 y = -2147483648 3379 r = x % y 3380 if r != -2147483647 { 3381 t.Errorf("-2147483647 %s -2147483648 = %d, want -2147483647", "%", r) 3382 } 3383 y = -2147483647 3384 r = x % y 3385 if r != 0 { 3386 t.Errorf("-2147483647 %s -2147483647 = %d, want 0", "%", r) 3387 } 3388 y = -1 3389 r = x % y 3390 if r != 0 { 3391 t.Errorf("-2147483647 %s -1 = %d, want 0", "%", r) 3392 } 3393 y = 1 3394 r = x % y 3395 if r != 0 { 3396 t.Errorf("-2147483647 %s 1 = %d, want 0", "%", r) 3397 } 3398 y = 2147483647 3399 r = x % y 3400 if r != 0 { 3401 t.Errorf("-2147483647 %s 2147483647 = %d, want 0", "%", r) 3402 } 3403 x = -1 3404 y = -2147483648 3405 r = x % y 3406 if r != -1 { 3407 t.Errorf("-1 %s -2147483648 = %d, want -1", "%", r) 3408 } 3409 y = -2147483647 3410 r = x % y 3411 if r != -1 { 3412 t.Errorf("-1 %s -2147483647 = %d, want -1", "%", r) 3413 } 3414 y = -1 3415 r = x % y 3416 if r != 0 { 3417 t.Errorf("-1 %s -1 = %d, want 0", "%", r) 3418 } 3419 y = 1 3420 r = x % y 3421 if r != 0 { 3422 t.Errorf("-1 %s 1 = %d, want 0", "%", r) 3423 } 3424 y = 2147483647 3425 r = x % y 3426 if r != -1 { 3427 t.Errorf("-1 %s 2147483647 = %d, want -1", "%", r) 3428 } 3429 x = 0 3430 y = -2147483648 3431 r = x % y 3432 if r != 0 { 3433 t.Errorf("0 %s -2147483648 = %d, want 0", "%", r) 3434 } 3435 y = -2147483647 3436 r = x % y 3437 if r != 0 { 3438 t.Errorf("0 %s -2147483647 = %d, want 0", "%", r) 3439 } 3440 y = -1 3441 r = x % y 3442 if r != 0 { 3443 t.Errorf("0 %s -1 = %d, want 0", "%", r) 3444 } 3445 y = 1 3446 r = x % y 3447 if r != 0 { 3448 t.Errorf("0 %s 1 = %d, want 0", "%", r) 3449 } 3450 y = 2147483647 3451 r = x % y 3452 if r != 0 { 3453 t.Errorf("0 %s 2147483647 = %d, want 0", "%", r) 3454 } 3455 x = 1 3456 y = -2147483648 3457 r = x % y 3458 if r != 1 { 3459 t.Errorf("1 %s -2147483648 = %d, want 1", "%", r) 3460 } 3461 y = -2147483647 3462 r = x % y 3463 if r != 1 { 3464 t.Errorf("1 %s -2147483647 = %d, want 1", "%", r) 3465 } 3466 y = -1 3467 r = x % y 3468 if r != 0 { 3469 t.Errorf("1 %s -1 = %d, want 0", "%", r) 3470 } 3471 y = 1 3472 r = x % y 3473 if r != 0 { 3474 t.Errorf("1 %s 1 = %d, want 0", "%", r) 3475 } 3476 y = 2147483647 3477 r = x % y 3478 if r != 1 { 3479 t.Errorf("1 %s 2147483647 = %d, want 1", "%", r) 3480 } 3481 x = 2147483647 3482 y = -2147483648 3483 r = x % y 3484 if r != 2147483647 { 3485 t.Errorf("2147483647 %s -2147483648 = %d, want 2147483647", "%", r) 3486 } 3487 y = -2147483647 3488 r = x % y 3489 if r != 0 { 3490 t.Errorf("2147483647 %s -2147483647 = %d, want 0", "%", r) 3491 } 3492 y = -1 3493 r = x % y 3494 if r != 0 { 3495 t.Errorf("2147483647 %s -1 = %d, want 0", "%", r) 3496 } 3497 y = 1 3498 r = x % y 3499 if r != 0 { 3500 t.Errorf("2147483647 %s 1 = %d, want 0", "%", r) 3501 } 3502 y = 2147483647 3503 r = x % y 3504 if r != 0 { 3505 t.Errorf("2147483647 %s 2147483647 = %d, want 0", "%", r) 3506 } 3507 } 3508 func TestConstFolduint16add(t *testing.T) { 3509 var x, y, r uint16 3510 x = 0 3511 y = 0 3512 r = x + y 3513 if r != 0 { 3514 t.Errorf("0 %s 0 = %d, want 0", "+", r) 3515 } 3516 y = 1 3517 r = x + y 3518 if r != 1 { 3519 t.Errorf("0 %s 1 = %d, want 1", "+", r) 3520 } 3521 y = 65535 3522 r = x + y 3523 if r != 65535 { 3524 t.Errorf("0 %s 65535 = %d, want 65535", "+", r) 3525 } 3526 x = 1 3527 y = 0 3528 r = x + y 3529 if r != 1 { 3530 t.Errorf("1 %s 0 = %d, want 1", "+", r) 3531 } 3532 y = 1 3533 r = x + y 3534 if r != 2 { 3535 t.Errorf("1 %s 1 = %d, want 2", "+", r) 3536 } 3537 y = 65535 3538 r = x + y 3539 if r != 0 { 3540 t.Errorf("1 %s 65535 = %d, want 0", "+", r) 3541 } 3542 x = 65535 3543 y = 0 3544 r = x + y 3545 if r != 65535 { 3546 t.Errorf("65535 %s 0 = %d, want 65535", "+", r) 3547 } 3548 y = 1 3549 r = x + y 3550 if r != 0 { 3551 t.Errorf("65535 %s 1 = %d, want 0", "+", r) 3552 } 3553 y = 65535 3554 r = x + y 3555 if r != 65534 { 3556 t.Errorf("65535 %s 65535 = %d, want 65534", "+", r) 3557 } 3558 } 3559 func TestConstFolduint16sub(t *testing.T) { 3560 var x, y, r uint16 3561 x = 0 3562 y = 0 3563 r = x - y 3564 if r != 0 { 3565 t.Errorf("0 %s 0 = %d, want 0", "-", r) 3566 } 3567 y = 1 3568 r = x - y 3569 if r != 65535 { 3570 t.Errorf("0 %s 1 = %d, want 65535", "-", r) 3571 } 3572 y = 65535 3573 r = x - y 3574 if r != 1 { 3575 t.Errorf("0 %s 65535 = %d, want 1", "-", r) 3576 } 3577 x = 1 3578 y = 0 3579 r = x - y 3580 if r != 1 { 3581 t.Errorf("1 %s 0 = %d, want 1", "-", r) 3582 } 3583 y = 1 3584 r = x - y 3585 if r != 0 { 3586 t.Errorf("1 %s 1 = %d, want 0", "-", r) 3587 } 3588 y = 65535 3589 r = x - y 3590 if r != 2 { 3591 t.Errorf("1 %s 65535 = %d, want 2", "-", r) 3592 } 3593 x = 65535 3594 y = 0 3595 r = x - y 3596 if r != 65535 { 3597 t.Errorf("65535 %s 0 = %d, want 65535", "-", r) 3598 } 3599 y = 1 3600 r = x - y 3601 if r != 65534 { 3602 t.Errorf("65535 %s 1 = %d, want 65534", "-", r) 3603 } 3604 y = 65535 3605 r = x - y 3606 if r != 0 { 3607 t.Errorf("65535 %s 65535 = %d, want 0", "-", r) 3608 } 3609 } 3610 func TestConstFolduint16div(t *testing.T) { 3611 var x, y, r uint16 3612 x = 0 3613 y = 1 3614 r = x / y 3615 if r != 0 { 3616 t.Errorf("0 %s 1 = %d, want 0", "/", r) 3617 } 3618 y = 65535 3619 r = x / y 3620 if r != 0 { 3621 t.Errorf("0 %s 65535 = %d, want 0", "/", r) 3622 } 3623 x = 1 3624 y = 1 3625 r = x / y 3626 if r != 1 { 3627 t.Errorf("1 %s 1 = %d, want 1", "/", r) 3628 } 3629 y = 65535 3630 r = x / y 3631 if r != 0 { 3632 t.Errorf("1 %s 65535 = %d, want 0", "/", r) 3633 } 3634 x = 65535 3635 y = 1 3636 r = x / y 3637 if r != 65535 { 3638 t.Errorf("65535 %s 1 = %d, want 65535", "/", r) 3639 } 3640 y = 65535 3641 r = x / y 3642 if r != 1 { 3643 t.Errorf("65535 %s 65535 = %d, want 1", "/", r) 3644 } 3645 } 3646 func TestConstFolduint16mul(t *testing.T) { 3647 var x, y, r uint16 3648 x = 0 3649 y = 0 3650 r = x * y 3651 if r != 0 { 3652 t.Errorf("0 %s 0 = %d, want 0", "*", r) 3653 } 3654 y = 1 3655 r = x * y 3656 if r != 0 { 3657 t.Errorf("0 %s 1 = %d, want 0", "*", r) 3658 } 3659 y = 65535 3660 r = x * y 3661 if r != 0 { 3662 t.Errorf("0 %s 65535 = %d, want 0", "*", r) 3663 } 3664 x = 1 3665 y = 0 3666 r = x * y 3667 if r != 0 { 3668 t.Errorf("1 %s 0 = %d, want 0", "*", r) 3669 } 3670 y = 1 3671 r = x * y 3672 if r != 1 { 3673 t.Errorf("1 %s 1 = %d, want 1", "*", r) 3674 } 3675 y = 65535 3676 r = x * y 3677 if r != 65535 { 3678 t.Errorf("1 %s 65535 = %d, want 65535", "*", r) 3679 } 3680 x = 65535 3681 y = 0 3682 r = x * y 3683 if r != 0 { 3684 t.Errorf("65535 %s 0 = %d, want 0", "*", r) 3685 } 3686 y = 1 3687 r = x * y 3688 if r != 65535 { 3689 t.Errorf("65535 %s 1 = %d, want 65535", "*", r) 3690 } 3691 y = 65535 3692 r = x * y 3693 if r != 1 { 3694 t.Errorf("65535 %s 65535 = %d, want 1", "*", r) 3695 } 3696 } 3697 func TestConstFolduint16mod(t *testing.T) { 3698 var x, y, r uint16 3699 x = 0 3700 y = 1 3701 r = x % y 3702 if r != 0 { 3703 t.Errorf("0 %s 1 = %d, want 0", "%", r) 3704 } 3705 y = 65535 3706 r = x % y 3707 if r != 0 { 3708 t.Errorf("0 %s 65535 = %d, want 0", "%", r) 3709 } 3710 x = 1 3711 y = 1 3712 r = x % y 3713 if r != 0 { 3714 t.Errorf("1 %s 1 = %d, want 0", "%", r) 3715 } 3716 y = 65535 3717 r = x % y 3718 if r != 1 { 3719 t.Errorf("1 %s 65535 = %d, want 1", "%", r) 3720 } 3721 x = 65535 3722 y = 1 3723 r = x % y 3724 if r != 0 { 3725 t.Errorf("65535 %s 1 = %d, want 0", "%", r) 3726 } 3727 y = 65535 3728 r = x % y 3729 if r != 0 { 3730 t.Errorf("65535 %s 65535 = %d, want 0", "%", r) 3731 } 3732 } 3733 func TestConstFoldint16add(t *testing.T) { 3734 var x, y, r int16 3735 x = -32768 3736 y = -32768 3737 r = x + y 3738 if r != 0 { 3739 t.Errorf("-32768 %s -32768 = %d, want 0", "+", r) 3740 } 3741 y = -32767 3742 r = x + y 3743 if r != 1 { 3744 t.Errorf("-32768 %s -32767 = %d, want 1", "+", r) 3745 } 3746 y = -1 3747 r = x + y 3748 if r != 32767 { 3749 t.Errorf("-32768 %s -1 = %d, want 32767", "+", r) 3750 } 3751 y = 0 3752 r = x + y 3753 if r != -32768 { 3754 t.Errorf("-32768 %s 0 = %d, want -32768", "+", r) 3755 } 3756 y = 1 3757 r = x + y 3758 if r != -32767 { 3759 t.Errorf("-32768 %s 1 = %d, want -32767", "+", r) 3760 } 3761 y = 32766 3762 r = x + y 3763 if r != -2 { 3764 t.Errorf("-32768 %s 32766 = %d, want -2", "+", r) 3765 } 3766 y = 32767 3767 r = x + y 3768 if r != -1 { 3769 t.Errorf("-32768 %s 32767 = %d, want -1", "+", r) 3770 } 3771 x = -32767 3772 y = -32768 3773 r = x + y 3774 if r != 1 { 3775 t.Errorf("-32767 %s -32768 = %d, want 1", "+", r) 3776 } 3777 y = -32767 3778 r = x + y 3779 if r != 2 { 3780 t.Errorf("-32767 %s -32767 = %d, want 2", "+", r) 3781 } 3782 y = -1 3783 r = x + y 3784 if r != -32768 { 3785 t.Errorf("-32767 %s -1 = %d, want -32768", "+", r) 3786 } 3787 y = 0 3788 r = x + y 3789 if r != -32767 { 3790 t.Errorf("-32767 %s 0 = %d, want -32767", "+", r) 3791 } 3792 y = 1 3793 r = x + y 3794 if r != -32766 { 3795 t.Errorf("-32767 %s 1 = %d, want -32766", "+", r) 3796 } 3797 y = 32766 3798 r = x + y 3799 if r != -1 { 3800 t.Errorf("-32767 %s 32766 = %d, want -1", "+", r) 3801 } 3802 y = 32767 3803 r = x + y 3804 if r != 0 { 3805 t.Errorf("-32767 %s 32767 = %d, want 0", "+", r) 3806 } 3807 x = -1 3808 y = -32768 3809 r = x + y 3810 if r != 32767 { 3811 t.Errorf("-1 %s -32768 = %d, want 32767", "+", r) 3812 } 3813 y = -32767 3814 r = x + y 3815 if r != -32768 { 3816 t.Errorf("-1 %s -32767 = %d, want -32768", "+", r) 3817 } 3818 y = -1 3819 r = x + y 3820 if r != -2 { 3821 t.Errorf("-1 %s -1 = %d, want -2", "+", r) 3822 } 3823 y = 0 3824 r = x + y 3825 if r != -1 { 3826 t.Errorf("-1 %s 0 = %d, want -1", "+", r) 3827 } 3828 y = 1 3829 r = x + y 3830 if r != 0 { 3831 t.Errorf("-1 %s 1 = %d, want 0", "+", r) 3832 } 3833 y = 32766 3834 r = x + y 3835 if r != 32765 { 3836 t.Errorf("-1 %s 32766 = %d, want 32765", "+", r) 3837 } 3838 y = 32767 3839 r = x + y 3840 if r != 32766 { 3841 t.Errorf("-1 %s 32767 = %d, want 32766", "+", r) 3842 } 3843 x = 0 3844 y = -32768 3845 r = x + y 3846 if r != -32768 { 3847 t.Errorf("0 %s -32768 = %d, want -32768", "+", r) 3848 } 3849 y = -32767 3850 r = x + y 3851 if r != -32767 { 3852 t.Errorf("0 %s -32767 = %d, want -32767", "+", r) 3853 } 3854 y = -1 3855 r = x + y 3856 if r != -1 { 3857 t.Errorf("0 %s -1 = %d, want -1", "+", r) 3858 } 3859 y = 0 3860 r = x + y 3861 if r != 0 { 3862 t.Errorf("0 %s 0 = %d, want 0", "+", r) 3863 } 3864 y = 1 3865 r = x + y 3866 if r != 1 { 3867 t.Errorf("0 %s 1 = %d, want 1", "+", r) 3868 } 3869 y = 32766 3870 r = x + y 3871 if r != 32766 { 3872 t.Errorf("0 %s 32766 = %d, want 32766", "+", r) 3873 } 3874 y = 32767 3875 r = x + y 3876 if r != 32767 { 3877 t.Errorf("0 %s 32767 = %d, want 32767", "+", r) 3878 } 3879 x = 1 3880 y = -32768 3881 r = x + y 3882 if r != -32767 { 3883 t.Errorf("1 %s -32768 = %d, want -32767", "+", r) 3884 } 3885 y = -32767 3886 r = x + y 3887 if r != -32766 { 3888 t.Errorf("1 %s -32767 = %d, want -32766", "+", r) 3889 } 3890 y = -1 3891 r = x + y 3892 if r != 0 { 3893 t.Errorf("1 %s -1 = %d, want 0", "+", r) 3894 } 3895 y = 0 3896 r = x + y 3897 if r != 1 { 3898 t.Errorf("1 %s 0 = %d, want 1", "+", r) 3899 } 3900 y = 1 3901 r = x + y 3902 if r != 2 { 3903 t.Errorf("1 %s 1 = %d, want 2", "+", r) 3904 } 3905 y = 32766 3906 r = x + y 3907 if r != 32767 { 3908 t.Errorf("1 %s 32766 = %d, want 32767", "+", r) 3909 } 3910 y = 32767 3911 r = x + y 3912 if r != -32768 { 3913 t.Errorf("1 %s 32767 = %d, want -32768", "+", r) 3914 } 3915 x = 32766 3916 y = -32768 3917 r = x + y 3918 if r != -2 { 3919 t.Errorf("32766 %s -32768 = %d, want -2", "+", r) 3920 } 3921 y = -32767 3922 r = x + y 3923 if r != -1 { 3924 t.Errorf("32766 %s -32767 = %d, want -1", "+", r) 3925 } 3926 y = -1 3927 r = x + y 3928 if r != 32765 { 3929 t.Errorf("32766 %s -1 = %d, want 32765", "+", r) 3930 } 3931 y = 0 3932 r = x + y 3933 if r != 32766 { 3934 t.Errorf("32766 %s 0 = %d, want 32766", "+", r) 3935 } 3936 y = 1 3937 r = x + y 3938 if r != 32767 { 3939 t.Errorf("32766 %s 1 = %d, want 32767", "+", r) 3940 } 3941 y = 32766 3942 r = x + y 3943 if r != -4 { 3944 t.Errorf("32766 %s 32766 = %d, want -4", "+", r) 3945 } 3946 y = 32767 3947 r = x + y 3948 if r != -3 { 3949 t.Errorf("32766 %s 32767 = %d, want -3", "+", r) 3950 } 3951 x = 32767 3952 y = -32768 3953 r = x + y 3954 if r != -1 { 3955 t.Errorf("32767 %s -32768 = %d, want -1", "+", r) 3956 } 3957 y = -32767 3958 r = x + y 3959 if r != 0 { 3960 t.Errorf("32767 %s -32767 = %d, want 0", "+", r) 3961 } 3962 y = -1 3963 r = x + y 3964 if r != 32766 { 3965 t.Errorf("32767 %s -1 = %d, want 32766", "+", r) 3966 } 3967 y = 0 3968 r = x + y 3969 if r != 32767 { 3970 t.Errorf("32767 %s 0 = %d, want 32767", "+", r) 3971 } 3972 y = 1 3973 r = x + y 3974 if r != -32768 { 3975 t.Errorf("32767 %s 1 = %d, want -32768", "+", r) 3976 } 3977 y = 32766 3978 r = x + y 3979 if r != -3 { 3980 t.Errorf("32767 %s 32766 = %d, want -3", "+", r) 3981 } 3982 y = 32767 3983 r = x + y 3984 if r != -2 { 3985 t.Errorf("32767 %s 32767 = %d, want -2", "+", r) 3986 } 3987 } 3988 func TestConstFoldint16sub(t *testing.T) { 3989 var x, y, r int16 3990 x = -32768 3991 y = -32768 3992 r = x - y 3993 if r != 0 { 3994 t.Errorf("-32768 %s -32768 = %d, want 0", "-", r) 3995 } 3996 y = -32767 3997 r = x - y 3998 if r != -1 { 3999 t.Errorf("-32768 %s -32767 = %d, want -1", "-", r) 4000 } 4001 y = -1 4002 r = x - y 4003 if r != -32767 { 4004 t.Errorf("-32768 %s -1 = %d, want -32767", "-", r) 4005 } 4006 y = 0 4007 r = x - y 4008 if r != -32768 { 4009 t.Errorf("-32768 %s 0 = %d, want -32768", "-", r) 4010 } 4011 y = 1 4012 r = x - y 4013 if r != 32767 { 4014 t.Errorf("-32768 %s 1 = %d, want 32767", "-", r) 4015 } 4016 y = 32766 4017 r = x - y 4018 if r != 2 { 4019 t.Errorf("-32768 %s 32766 = %d, want 2", "-", r) 4020 } 4021 y = 32767 4022 r = x - y 4023 if r != 1 { 4024 t.Errorf("-32768 %s 32767 = %d, want 1", "-", r) 4025 } 4026 x = -32767 4027 y = -32768 4028 r = x - y 4029 if r != 1 { 4030 t.Errorf("-32767 %s -32768 = %d, want 1", "-", r) 4031 } 4032 y = -32767 4033 r = x - y 4034 if r != 0 { 4035 t.Errorf("-32767 %s -32767 = %d, want 0", "-", r) 4036 } 4037 y = -1 4038 r = x - y 4039 if r != -32766 { 4040 t.Errorf("-32767 %s -1 = %d, want -32766", "-", r) 4041 } 4042 y = 0 4043 r = x - y 4044 if r != -32767 { 4045 t.Errorf("-32767 %s 0 = %d, want -32767", "-", r) 4046 } 4047 y = 1 4048 r = x - y 4049 if r != -32768 { 4050 t.Errorf("-32767 %s 1 = %d, want -32768", "-", r) 4051 } 4052 y = 32766 4053 r = x - y 4054 if r != 3 { 4055 t.Errorf("-32767 %s 32766 = %d, want 3", "-", r) 4056 } 4057 y = 32767 4058 r = x - y 4059 if r != 2 { 4060 t.Errorf("-32767 %s 32767 = %d, want 2", "-", r) 4061 } 4062 x = -1 4063 y = -32768 4064 r = x - y 4065 if r != 32767 { 4066 t.Errorf("-1 %s -32768 = %d, want 32767", "-", r) 4067 } 4068 y = -32767 4069 r = x - y 4070 if r != 32766 { 4071 t.Errorf("-1 %s -32767 = %d, want 32766", "-", r) 4072 } 4073 y = -1 4074 r = x - y 4075 if r != 0 { 4076 t.Errorf("-1 %s -1 = %d, want 0", "-", r) 4077 } 4078 y = 0 4079 r = x - y 4080 if r != -1 { 4081 t.Errorf("-1 %s 0 = %d, want -1", "-", r) 4082 } 4083 y = 1 4084 r = x - y 4085 if r != -2 { 4086 t.Errorf("-1 %s 1 = %d, want -2", "-", r) 4087 } 4088 y = 32766 4089 r = x - y 4090 if r != -32767 { 4091 t.Errorf("-1 %s 32766 = %d, want -32767", "-", r) 4092 } 4093 y = 32767 4094 r = x - y 4095 if r != -32768 { 4096 t.Errorf("-1 %s 32767 = %d, want -32768", "-", r) 4097 } 4098 x = 0 4099 y = -32768 4100 r = x - y 4101 if r != -32768 { 4102 t.Errorf("0 %s -32768 = %d, want -32768", "-", r) 4103 } 4104 y = -32767 4105 r = x - y 4106 if r != 32767 { 4107 t.Errorf("0 %s -32767 = %d, want 32767", "-", r) 4108 } 4109 y = -1 4110 r = x - y 4111 if r != 1 { 4112 t.Errorf("0 %s -1 = %d, want 1", "-", r) 4113 } 4114 y = 0 4115 r = x - y 4116 if r != 0 { 4117 t.Errorf("0 %s 0 = %d, want 0", "-", r) 4118 } 4119 y = 1 4120 r = x - y 4121 if r != -1 { 4122 t.Errorf("0 %s 1 = %d, want -1", "-", r) 4123 } 4124 y = 32766 4125 r = x - y 4126 if r != -32766 { 4127 t.Errorf("0 %s 32766 = %d, want -32766", "-", r) 4128 } 4129 y = 32767 4130 r = x - y 4131 if r != -32767 { 4132 t.Errorf("0 %s 32767 = %d, want -32767", "-", r) 4133 } 4134 x = 1 4135 y = -32768 4136 r = x - y 4137 if r != -32767 { 4138 t.Errorf("1 %s -32768 = %d, want -32767", "-", r) 4139 } 4140 y = -32767 4141 r = x - y 4142 if r != -32768 { 4143 t.Errorf("1 %s -32767 = %d, want -32768", "-", r) 4144 } 4145 y = -1 4146 r = x - y 4147 if r != 2 { 4148 t.Errorf("1 %s -1 = %d, want 2", "-", r) 4149 } 4150 y = 0 4151 r = x - y 4152 if r != 1 { 4153 t.Errorf("1 %s 0 = %d, want 1", "-", r) 4154 } 4155 y = 1 4156 r = x - y 4157 if r != 0 { 4158 t.Errorf("1 %s 1 = %d, want 0", "-", r) 4159 } 4160 y = 32766 4161 r = x - y 4162 if r != -32765 { 4163 t.Errorf("1 %s 32766 = %d, want -32765", "-", r) 4164 } 4165 y = 32767 4166 r = x - y 4167 if r != -32766 { 4168 t.Errorf("1 %s 32767 = %d, want -32766", "-", r) 4169 } 4170 x = 32766 4171 y = -32768 4172 r = x - y 4173 if r != -2 { 4174 t.Errorf("32766 %s -32768 = %d, want -2", "-", r) 4175 } 4176 y = -32767 4177 r = x - y 4178 if r != -3 { 4179 t.Errorf("32766 %s -32767 = %d, want -3", "-", r) 4180 } 4181 y = -1 4182 r = x - y 4183 if r != 32767 { 4184 t.Errorf("32766 %s -1 = %d, want 32767", "-", r) 4185 } 4186 y = 0 4187 r = x - y 4188 if r != 32766 { 4189 t.Errorf("32766 %s 0 = %d, want 32766", "-", r) 4190 } 4191 y = 1 4192 r = x - y 4193 if r != 32765 { 4194 t.Errorf("32766 %s 1 = %d, want 32765", "-", r) 4195 } 4196 y = 32766 4197 r = x - y 4198 if r != 0 { 4199 t.Errorf("32766 %s 32766 = %d, want 0", "-", r) 4200 } 4201 y = 32767 4202 r = x - y 4203 if r != -1 { 4204 t.Errorf("32766 %s 32767 = %d, want -1", "-", r) 4205 } 4206 x = 32767 4207 y = -32768 4208 r = x - y 4209 if r != -1 { 4210 t.Errorf("32767 %s -32768 = %d, want -1", "-", r) 4211 } 4212 y = -32767 4213 r = x - y 4214 if r != -2 { 4215 t.Errorf("32767 %s -32767 = %d, want -2", "-", r) 4216 } 4217 y = -1 4218 r = x - y 4219 if r != -32768 { 4220 t.Errorf("32767 %s -1 = %d, want -32768", "-", r) 4221 } 4222 y = 0 4223 r = x - y 4224 if r != 32767 { 4225 t.Errorf("32767 %s 0 = %d, want 32767", "-", r) 4226 } 4227 y = 1 4228 r = x - y 4229 if r != 32766 { 4230 t.Errorf("32767 %s 1 = %d, want 32766", "-", r) 4231 } 4232 y = 32766 4233 r = x - y 4234 if r != 1 { 4235 t.Errorf("32767 %s 32766 = %d, want 1", "-", r) 4236 } 4237 y = 32767 4238 r = x - y 4239 if r != 0 { 4240 t.Errorf("32767 %s 32767 = %d, want 0", "-", r) 4241 } 4242 } 4243 func TestConstFoldint16div(t *testing.T) { 4244 var x, y, r int16 4245 x = -32768 4246 y = -32768 4247 r = x / y 4248 if r != 1 { 4249 t.Errorf("-32768 %s -32768 = %d, want 1", "/", r) 4250 } 4251 y = -32767 4252 r = x / y 4253 if r != 1 { 4254 t.Errorf("-32768 %s -32767 = %d, want 1", "/", r) 4255 } 4256 y = -1 4257 r = x / y 4258 if r != -32768 { 4259 t.Errorf("-32768 %s -1 = %d, want -32768", "/", r) 4260 } 4261 y = 1 4262 r = x / y 4263 if r != -32768 { 4264 t.Errorf("-32768 %s 1 = %d, want -32768", "/", r) 4265 } 4266 y = 32766 4267 r = x / y 4268 if r != -1 { 4269 t.Errorf("-32768 %s 32766 = %d, want -1", "/", r) 4270 } 4271 y = 32767 4272 r = x / y 4273 if r != -1 { 4274 t.Errorf("-32768 %s 32767 = %d, want -1", "/", r) 4275 } 4276 x = -32767 4277 y = -32768 4278 r = x / y 4279 if r != 0 { 4280 t.Errorf("-32767 %s -32768 = %d, want 0", "/", r) 4281 } 4282 y = -32767 4283 r = x / y 4284 if r != 1 { 4285 t.Errorf("-32767 %s -32767 = %d, want 1", "/", r) 4286 } 4287 y = -1 4288 r = x / y 4289 if r != 32767 { 4290 t.Errorf("-32767 %s -1 = %d, want 32767", "/", r) 4291 } 4292 y = 1 4293 r = x / y 4294 if r != -32767 { 4295 t.Errorf("-32767 %s 1 = %d, want -32767", "/", r) 4296 } 4297 y = 32766 4298 r = x / y 4299 if r != -1 { 4300 t.Errorf("-32767 %s 32766 = %d, want -1", "/", r) 4301 } 4302 y = 32767 4303 r = x / y 4304 if r != -1 { 4305 t.Errorf("-32767 %s 32767 = %d, want -1", "/", r) 4306 } 4307 x = -1 4308 y = -32768 4309 r = x / y 4310 if r != 0 { 4311 t.Errorf("-1 %s -32768 = %d, want 0", "/", r) 4312 } 4313 y = -32767 4314 r = x / y 4315 if r != 0 { 4316 t.Errorf("-1 %s -32767 = %d, want 0", "/", r) 4317 } 4318 y = -1 4319 r = x / y 4320 if r != 1 { 4321 t.Errorf("-1 %s -1 = %d, want 1", "/", r) 4322 } 4323 y = 1 4324 r = x / y 4325 if r != -1 { 4326 t.Errorf("-1 %s 1 = %d, want -1", "/", r) 4327 } 4328 y = 32766 4329 r = x / y 4330 if r != 0 { 4331 t.Errorf("-1 %s 32766 = %d, want 0", "/", r) 4332 } 4333 y = 32767 4334 r = x / y 4335 if r != 0 { 4336 t.Errorf("-1 %s 32767 = %d, want 0", "/", r) 4337 } 4338 x = 0 4339 y = -32768 4340 r = x / y 4341 if r != 0 { 4342 t.Errorf("0 %s -32768 = %d, want 0", "/", r) 4343 } 4344 y = -32767 4345 r = x / y 4346 if r != 0 { 4347 t.Errorf("0 %s -32767 = %d, want 0", "/", r) 4348 } 4349 y = -1 4350 r = x / y 4351 if r != 0 { 4352 t.Errorf("0 %s -1 = %d, want 0", "/", r) 4353 } 4354 y = 1 4355 r = x / y 4356 if r != 0 { 4357 t.Errorf("0 %s 1 = %d, want 0", "/", r) 4358 } 4359 y = 32766 4360 r = x / y 4361 if r != 0 { 4362 t.Errorf("0 %s 32766 = %d, want 0", "/", r) 4363 } 4364 y = 32767 4365 r = x / y 4366 if r != 0 { 4367 t.Errorf("0 %s 32767 = %d, want 0", "/", r) 4368 } 4369 x = 1 4370 y = -32768 4371 r = x / y 4372 if r != 0 { 4373 t.Errorf("1 %s -32768 = %d, want 0", "/", r) 4374 } 4375 y = -32767 4376 r = x / y 4377 if r != 0 { 4378 t.Errorf("1 %s -32767 = %d, want 0", "/", r) 4379 } 4380 y = -1 4381 r = x / y 4382 if r != -1 { 4383 t.Errorf("1 %s -1 = %d, want -1", "/", r) 4384 } 4385 y = 1 4386 r = x / y 4387 if r != 1 { 4388 t.Errorf("1 %s 1 = %d, want 1", "/", r) 4389 } 4390 y = 32766 4391 r = x / y 4392 if r != 0 { 4393 t.Errorf("1 %s 32766 = %d, want 0", "/", r) 4394 } 4395 y = 32767 4396 r = x / y 4397 if r != 0 { 4398 t.Errorf("1 %s 32767 = %d, want 0", "/", r) 4399 } 4400 x = 32766 4401 y = -32768 4402 r = x / y 4403 if r != 0 { 4404 t.Errorf("32766 %s -32768 = %d, want 0", "/", r) 4405 } 4406 y = -32767 4407 r = x / y 4408 if r != 0 { 4409 t.Errorf("32766 %s -32767 = %d, want 0", "/", r) 4410 } 4411 y = -1 4412 r = x / y 4413 if r != -32766 { 4414 t.Errorf("32766 %s -1 = %d, want -32766", "/", r) 4415 } 4416 y = 1 4417 r = x / y 4418 if r != 32766 { 4419 t.Errorf("32766 %s 1 = %d, want 32766", "/", r) 4420 } 4421 y = 32766 4422 r = x / y 4423 if r != 1 { 4424 t.Errorf("32766 %s 32766 = %d, want 1", "/", r) 4425 } 4426 y = 32767 4427 r = x / y 4428 if r != 0 { 4429 t.Errorf("32766 %s 32767 = %d, want 0", "/", r) 4430 } 4431 x = 32767 4432 y = -32768 4433 r = x / y 4434 if r != 0 { 4435 t.Errorf("32767 %s -32768 = %d, want 0", "/", r) 4436 } 4437 y = -32767 4438 r = x / y 4439 if r != -1 { 4440 t.Errorf("32767 %s -32767 = %d, want -1", "/", r) 4441 } 4442 y = -1 4443 r = x / y 4444 if r != -32767 { 4445 t.Errorf("32767 %s -1 = %d, want -32767", "/", r) 4446 } 4447 y = 1 4448 r = x / y 4449 if r != 32767 { 4450 t.Errorf("32767 %s 1 = %d, want 32767", "/", r) 4451 } 4452 y = 32766 4453 r = x / y 4454 if r != 1 { 4455 t.Errorf("32767 %s 32766 = %d, want 1", "/", r) 4456 } 4457 y = 32767 4458 r = x / y 4459 if r != 1 { 4460 t.Errorf("32767 %s 32767 = %d, want 1", "/", r) 4461 } 4462 } 4463 func TestConstFoldint16mul(t *testing.T) { 4464 var x, y, r int16 4465 x = -32768 4466 y = -32768 4467 r = x * y 4468 if r != 0 { 4469 t.Errorf("-32768 %s -32768 = %d, want 0", "*", r) 4470 } 4471 y = -32767 4472 r = x * y 4473 if r != -32768 { 4474 t.Errorf("-32768 %s -32767 = %d, want -32768", "*", r) 4475 } 4476 y = -1 4477 r = x * y 4478 if r != -32768 { 4479 t.Errorf("-32768 %s -1 = %d, want -32768", "*", r) 4480 } 4481 y = 0 4482 r = x * y 4483 if r != 0 { 4484 t.Errorf("-32768 %s 0 = %d, want 0", "*", r) 4485 } 4486 y = 1 4487 r = x * y 4488 if r != -32768 { 4489 t.Errorf("-32768 %s 1 = %d, want -32768", "*", r) 4490 } 4491 y = 32766 4492 r = x * y 4493 if r != 0 { 4494 t.Errorf("-32768 %s 32766 = %d, want 0", "*", r) 4495 } 4496 y = 32767 4497 r = x * y 4498 if r != -32768 { 4499 t.Errorf("-32768 %s 32767 = %d, want -32768", "*", r) 4500 } 4501 x = -32767 4502 y = -32768 4503 r = x * y 4504 if r != -32768 { 4505 t.Errorf("-32767 %s -32768 = %d, want -32768", "*", r) 4506 } 4507 y = -32767 4508 r = x * y 4509 if r != 1 { 4510 t.Errorf("-32767 %s -32767 = %d, want 1", "*", r) 4511 } 4512 y = -1 4513 r = x * y 4514 if r != 32767 { 4515 t.Errorf("-32767 %s -1 = %d, want 32767", "*", r) 4516 } 4517 y = 0 4518 r = x * y 4519 if r != 0 { 4520 t.Errorf("-32767 %s 0 = %d, want 0", "*", r) 4521 } 4522 y = 1 4523 r = x * y 4524 if r != -32767 { 4525 t.Errorf("-32767 %s 1 = %d, want -32767", "*", r) 4526 } 4527 y = 32766 4528 r = x * y 4529 if r != 32766 { 4530 t.Errorf("-32767 %s 32766 = %d, want 32766", "*", r) 4531 } 4532 y = 32767 4533 r = x * y 4534 if r != -1 { 4535 t.Errorf("-32767 %s 32767 = %d, want -1", "*", r) 4536 } 4537 x = -1 4538 y = -32768 4539 r = x * y 4540 if r != -32768 { 4541 t.Errorf("-1 %s -32768 = %d, want -32768", "*", r) 4542 } 4543 y = -32767 4544 r = x * y 4545 if r != 32767 { 4546 t.Errorf("-1 %s -32767 = %d, want 32767", "*", r) 4547 } 4548 y = -1 4549 r = x * y 4550 if r != 1 { 4551 t.Errorf("-1 %s -1 = %d, want 1", "*", r) 4552 } 4553 y = 0 4554 r = x * y 4555 if r != 0 { 4556 t.Errorf("-1 %s 0 = %d, want 0", "*", r) 4557 } 4558 y = 1 4559 r = x * y 4560 if r != -1 { 4561 t.Errorf("-1 %s 1 = %d, want -1", "*", r) 4562 } 4563 y = 32766 4564 r = x * y 4565 if r != -32766 { 4566 t.Errorf("-1 %s 32766 = %d, want -32766", "*", r) 4567 } 4568 y = 32767 4569 r = x * y 4570 if r != -32767 { 4571 t.Errorf("-1 %s 32767 = %d, want -32767", "*", r) 4572 } 4573 x = 0 4574 y = -32768 4575 r = x * y 4576 if r != 0 { 4577 t.Errorf("0 %s -32768 = %d, want 0", "*", r) 4578 } 4579 y = -32767 4580 r = x * y 4581 if r != 0 { 4582 t.Errorf("0 %s -32767 = %d, want 0", "*", r) 4583 } 4584 y = -1 4585 r = x * y 4586 if r != 0 { 4587 t.Errorf("0 %s -1 = %d, want 0", "*", r) 4588 } 4589 y = 0 4590 r = x * y 4591 if r != 0 { 4592 t.Errorf("0 %s 0 = %d, want 0", "*", r) 4593 } 4594 y = 1 4595 r = x * y 4596 if r != 0 { 4597 t.Errorf("0 %s 1 = %d, want 0", "*", r) 4598 } 4599 y = 32766 4600 r = x * y 4601 if r != 0 { 4602 t.Errorf("0 %s 32766 = %d, want 0", "*", r) 4603 } 4604 y = 32767 4605 r = x * y 4606 if r != 0 { 4607 t.Errorf("0 %s 32767 = %d, want 0", "*", r) 4608 } 4609 x = 1 4610 y = -32768 4611 r = x * y 4612 if r != -32768 { 4613 t.Errorf("1 %s -32768 = %d, want -32768", "*", r) 4614 } 4615 y = -32767 4616 r = x * y 4617 if r != -32767 { 4618 t.Errorf("1 %s -32767 = %d, want -32767", "*", r) 4619 } 4620 y = -1 4621 r = x * y 4622 if r != -1 { 4623 t.Errorf("1 %s -1 = %d, want -1", "*", r) 4624 } 4625 y = 0 4626 r = x * y 4627 if r != 0 { 4628 t.Errorf("1 %s 0 = %d, want 0", "*", r) 4629 } 4630 y = 1 4631 r = x * y 4632 if r != 1 { 4633 t.Errorf("1 %s 1 = %d, want 1", "*", r) 4634 } 4635 y = 32766 4636 r = x * y 4637 if r != 32766 { 4638 t.Errorf("1 %s 32766 = %d, want 32766", "*", r) 4639 } 4640 y = 32767 4641 r = x * y 4642 if r != 32767 { 4643 t.Errorf("1 %s 32767 = %d, want 32767", "*", r) 4644 } 4645 x = 32766 4646 y = -32768 4647 r = x * y 4648 if r != 0 { 4649 t.Errorf("32766 %s -32768 = %d, want 0", "*", r) 4650 } 4651 y = -32767 4652 r = x * y 4653 if r != 32766 { 4654 t.Errorf("32766 %s -32767 = %d, want 32766", "*", r) 4655 } 4656 y = -1 4657 r = x * y 4658 if r != -32766 { 4659 t.Errorf("32766 %s -1 = %d, want -32766", "*", r) 4660 } 4661 y = 0 4662 r = x * y 4663 if r != 0 { 4664 t.Errorf("32766 %s 0 = %d, want 0", "*", r) 4665 } 4666 y = 1 4667 r = x * y 4668 if r != 32766 { 4669 t.Errorf("32766 %s 1 = %d, want 32766", "*", r) 4670 } 4671 y = 32766 4672 r = x * y 4673 if r != 4 { 4674 t.Errorf("32766 %s 32766 = %d, want 4", "*", r) 4675 } 4676 y = 32767 4677 r = x * y 4678 if r != -32766 { 4679 t.Errorf("32766 %s 32767 = %d, want -32766", "*", r) 4680 } 4681 x = 32767 4682 y = -32768 4683 r = x * y 4684 if r != -32768 { 4685 t.Errorf("32767 %s -32768 = %d, want -32768", "*", r) 4686 } 4687 y = -32767 4688 r = x * y 4689 if r != -1 { 4690 t.Errorf("32767 %s -32767 = %d, want -1", "*", r) 4691 } 4692 y = -1 4693 r = x * y 4694 if r != -32767 { 4695 t.Errorf("32767 %s -1 = %d, want -32767", "*", r) 4696 } 4697 y = 0 4698 r = x * y 4699 if r != 0 { 4700 t.Errorf("32767 %s 0 = %d, want 0", "*", r) 4701 } 4702 y = 1 4703 r = x * y 4704 if r != 32767 { 4705 t.Errorf("32767 %s 1 = %d, want 32767", "*", r) 4706 } 4707 y = 32766 4708 r = x * y 4709 if r != -32766 { 4710 t.Errorf("32767 %s 32766 = %d, want -32766", "*", r) 4711 } 4712 y = 32767 4713 r = x * y 4714 if r != 1 { 4715 t.Errorf("32767 %s 32767 = %d, want 1", "*", r) 4716 } 4717 } 4718 func TestConstFoldint16mod(t *testing.T) { 4719 var x, y, r int16 4720 x = -32768 4721 y = -32768 4722 r = x % y 4723 if r != 0 { 4724 t.Errorf("-32768 %s -32768 = %d, want 0", "%", r) 4725 } 4726 y = -32767 4727 r = x % y 4728 if r != -1 { 4729 t.Errorf("-32768 %s -32767 = %d, want -1", "%", r) 4730 } 4731 y = -1 4732 r = x % y 4733 if r != 0 { 4734 t.Errorf("-32768 %s -1 = %d, want 0", "%", r) 4735 } 4736 y = 1 4737 r = x % y 4738 if r != 0 { 4739 t.Errorf("-32768 %s 1 = %d, want 0", "%", r) 4740 } 4741 y = 32766 4742 r = x % y 4743 if r != -2 { 4744 t.Errorf("-32768 %s 32766 = %d, want -2", "%", r) 4745 } 4746 y = 32767 4747 r = x % y 4748 if r != -1 { 4749 t.Errorf("-32768 %s 32767 = %d, want -1", "%", r) 4750 } 4751 x = -32767 4752 y = -32768 4753 r = x % y 4754 if r != -32767 { 4755 t.Errorf("-32767 %s -32768 = %d, want -32767", "%", r) 4756 } 4757 y = -32767 4758 r = x % y 4759 if r != 0 { 4760 t.Errorf("-32767 %s -32767 = %d, want 0", "%", r) 4761 } 4762 y = -1 4763 r = x % y 4764 if r != 0 { 4765 t.Errorf("-32767 %s -1 = %d, want 0", "%", r) 4766 } 4767 y = 1 4768 r = x % y 4769 if r != 0 { 4770 t.Errorf("-32767 %s 1 = %d, want 0", "%", r) 4771 } 4772 y = 32766 4773 r = x % y 4774 if r != -1 { 4775 t.Errorf("-32767 %s 32766 = %d, want -1", "%", r) 4776 } 4777 y = 32767 4778 r = x % y 4779 if r != 0 { 4780 t.Errorf("-32767 %s 32767 = %d, want 0", "%", r) 4781 } 4782 x = -1 4783 y = -32768 4784 r = x % y 4785 if r != -1 { 4786 t.Errorf("-1 %s -32768 = %d, want -1", "%", r) 4787 } 4788 y = -32767 4789 r = x % y 4790 if r != -1 { 4791 t.Errorf("-1 %s -32767 = %d, want -1", "%", r) 4792 } 4793 y = -1 4794 r = x % y 4795 if r != 0 { 4796 t.Errorf("-1 %s -1 = %d, want 0", "%", r) 4797 } 4798 y = 1 4799 r = x % y 4800 if r != 0 { 4801 t.Errorf("-1 %s 1 = %d, want 0", "%", r) 4802 } 4803 y = 32766 4804 r = x % y 4805 if r != -1 { 4806 t.Errorf("-1 %s 32766 = %d, want -1", "%", r) 4807 } 4808 y = 32767 4809 r = x % y 4810 if r != -1 { 4811 t.Errorf("-1 %s 32767 = %d, want -1", "%", r) 4812 } 4813 x = 0 4814 y = -32768 4815 r = x % y 4816 if r != 0 { 4817 t.Errorf("0 %s -32768 = %d, want 0", "%", r) 4818 } 4819 y = -32767 4820 r = x % y 4821 if r != 0 { 4822 t.Errorf("0 %s -32767 = %d, want 0", "%", r) 4823 } 4824 y = -1 4825 r = x % y 4826 if r != 0 { 4827 t.Errorf("0 %s -1 = %d, want 0", "%", r) 4828 } 4829 y = 1 4830 r = x % y 4831 if r != 0 { 4832 t.Errorf("0 %s 1 = %d, want 0", "%", r) 4833 } 4834 y = 32766 4835 r = x % y 4836 if r != 0 { 4837 t.Errorf("0 %s 32766 = %d, want 0", "%", r) 4838 } 4839 y = 32767 4840 r = x % y 4841 if r != 0 { 4842 t.Errorf("0 %s 32767 = %d, want 0", "%", r) 4843 } 4844 x = 1 4845 y = -32768 4846 r = x % y 4847 if r != 1 { 4848 t.Errorf("1 %s -32768 = %d, want 1", "%", r) 4849 } 4850 y = -32767 4851 r = x % y 4852 if r != 1 { 4853 t.Errorf("1 %s -32767 = %d, want 1", "%", r) 4854 } 4855 y = -1 4856 r = x % y 4857 if r != 0 { 4858 t.Errorf("1 %s -1 = %d, want 0", "%", r) 4859 } 4860 y = 1 4861 r = x % y 4862 if r != 0 { 4863 t.Errorf("1 %s 1 = %d, want 0", "%", r) 4864 } 4865 y = 32766 4866 r = x % y 4867 if r != 1 { 4868 t.Errorf("1 %s 32766 = %d, want 1", "%", r) 4869 } 4870 y = 32767 4871 r = x % y 4872 if r != 1 { 4873 t.Errorf("1 %s 32767 = %d, want 1", "%", r) 4874 } 4875 x = 32766 4876 y = -32768 4877 r = x % y 4878 if r != 32766 { 4879 t.Errorf("32766 %s -32768 = %d, want 32766", "%", r) 4880 } 4881 y = -32767 4882 r = x % y 4883 if r != 32766 { 4884 t.Errorf("32766 %s -32767 = %d, want 32766", "%", r) 4885 } 4886 y = -1 4887 r = x % y 4888 if r != 0 { 4889 t.Errorf("32766 %s -1 = %d, want 0", "%", r) 4890 } 4891 y = 1 4892 r = x % y 4893 if r != 0 { 4894 t.Errorf("32766 %s 1 = %d, want 0", "%", r) 4895 } 4896 y = 32766 4897 r = x % y 4898 if r != 0 { 4899 t.Errorf("32766 %s 32766 = %d, want 0", "%", r) 4900 } 4901 y = 32767 4902 r = x % y 4903 if r != 32766 { 4904 t.Errorf("32766 %s 32767 = %d, want 32766", "%", r) 4905 } 4906 x = 32767 4907 y = -32768 4908 r = x % y 4909 if r != 32767 { 4910 t.Errorf("32767 %s -32768 = %d, want 32767", "%", r) 4911 } 4912 y = -32767 4913 r = x % y 4914 if r != 0 { 4915 t.Errorf("32767 %s -32767 = %d, want 0", "%", r) 4916 } 4917 y = -1 4918 r = x % y 4919 if r != 0 { 4920 t.Errorf("32767 %s -1 = %d, want 0", "%", r) 4921 } 4922 y = 1 4923 r = x % y 4924 if r != 0 { 4925 t.Errorf("32767 %s 1 = %d, want 0", "%", r) 4926 } 4927 y = 32766 4928 r = x % y 4929 if r != 1 { 4930 t.Errorf("32767 %s 32766 = %d, want 1", "%", r) 4931 } 4932 y = 32767 4933 r = x % y 4934 if r != 0 { 4935 t.Errorf("32767 %s 32767 = %d, want 0", "%", r) 4936 } 4937 } 4938 func TestConstFolduint8add(t *testing.T) { 4939 var x, y, r uint8 4940 x = 0 4941 y = 0 4942 r = x + y 4943 if r != 0 { 4944 t.Errorf("0 %s 0 = %d, want 0", "+", r) 4945 } 4946 y = 1 4947 r = x + y 4948 if r != 1 { 4949 t.Errorf("0 %s 1 = %d, want 1", "+", r) 4950 } 4951 y = 255 4952 r = x + y 4953 if r != 255 { 4954 t.Errorf("0 %s 255 = %d, want 255", "+", r) 4955 } 4956 x = 1 4957 y = 0 4958 r = x + y 4959 if r != 1 { 4960 t.Errorf("1 %s 0 = %d, want 1", "+", r) 4961 } 4962 y = 1 4963 r = x + y 4964 if r != 2 { 4965 t.Errorf("1 %s 1 = %d, want 2", "+", r) 4966 } 4967 y = 255 4968 r = x + y 4969 if r != 0 { 4970 t.Errorf("1 %s 255 = %d, want 0", "+", r) 4971 } 4972 x = 255 4973 y = 0 4974 r = x + y 4975 if r != 255 { 4976 t.Errorf("255 %s 0 = %d, want 255", "+", r) 4977 } 4978 y = 1 4979 r = x + y 4980 if r != 0 { 4981 t.Errorf("255 %s 1 = %d, want 0", "+", r) 4982 } 4983 y = 255 4984 r = x + y 4985 if r != 254 { 4986 t.Errorf("255 %s 255 = %d, want 254", "+", r) 4987 } 4988 } 4989 func TestConstFolduint8sub(t *testing.T) { 4990 var x, y, r uint8 4991 x = 0 4992 y = 0 4993 r = x - y 4994 if r != 0 { 4995 t.Errorf("0 %s 0 = %d, want 0", "-", r) 4996 } 4997 y = 1 4998 r = x - y 4999 if r != 255 { 5000 t.Errorf("0 %s 1 = %d, want 255", "-", r) 5001 } 5002 y = 255 5003 r = x - y 5004 if r != 1 { 5005 t.Errorf("0 %s 255 = %d, want 1", "-", r) 5006 } 5007 x = 1 5008 y = 0 5009 r = x - y 5010 if r != 1 { 5011 t.Errorf("1 %s 0 = %d, want 1", "-", r) 5012 } 5013 y = 1 5014 r = x - y 5015 if r != 0 { 5016 t.Errorf("1 %s 1 = %d, want 0", "-", r) 5017 } 5018 y = 255 5019 r = x - y 5020 if r != 2 { 5021 t.Errorf("1 %s 255 = %d, want 2", "-", r) 5022 } 5023 x = 255 5024 y = 0 5025 r = x - y 5026 if r != 255 { 5027 t.Errorf("255 %s 0 = %d, want 255", "-", r) 5028 } 5029 y = 1 5030 r = x - y 5031 if r != 254 { 5032 t.Errorf("255 %s 1 = %d, want 254", "-", r) 5033 } 5034 y = 255 5035 r = x - y 5036 if r != 0 { 5037 t.Errorf("255 %s 255 = %d, want 0", "-", r) 5038 } 5039 } 5040 func TestConstFolduint8div(t *testing.T) { 5041 var x, y, r uint8 5042 x = 0 5043 y = 1 5044 r = x / y 5045 if r != 0 { 5046 t.Errorf("0 %s 1 = %d, want 0", "/", r) 5047 } 5048 y = 255 5049 r = x / y 5050 if r != 0 { 5051 t.Errorf("0 %s 255 = %d, want 0", "/", r) 5052 } 5053 x = 1 5054 y = 1 5055 r = x / y 5056 if r != 1 { 5057 t.Errorf("1 %s 1 = %d, want 1", "/", r) 5058 } 5059 y = 255 5060 r = x / y 5061 if r != 0 { 5062 t.Errorf("1 %s 255 = %d, want 0", "/", r) 5063 } 5064 x = 255 5065 y = 1 5066 r = x / y 5067 if r != 255 { 5068 t.Errorf("255 %s 1 = %d, want 255", "/", r) 5069 } 5070 y = 255 5071 r = x / y 5072 if r != 1 { 5073 t.Errorf("255 %s 255 = %d, want 1", "/", r) 5074 } 5075 } 5076 func TestConstFolduint8mul(t *testing.T) { 5077 var x, y, r uint8 5078 x = 0 5079 y = 0 5080 r = x * y 5081 if r != 0 { 5082 t.Errorf("0 %s 0 = %d, want 0", "*", r) 5083 } 5084 y = 1 5085 r = x * y 5086 if r != 0 { 5087 t.Errorf("0 %s 1 = %d, want 0", "*", r) 5088 } 5089 y = 255 5090 r = x * y 5091 if r != 0 { 5092 t.Errorf("0 %s 255 = %d, want 0", "*", r) 5093 } 5094 x = 1 5095 y = 0 5096 r = x * y 5097 if r != 0 { 5098 t.Errorf("1 %s 0 = %d, want 0", "*", r) 5099 } 5100 y = 1 5101 r = x * y 5102 if r != 1 { 5103 t.Errorf("1 %s 1 = %d, want 1", "*", r) 5104 } 5105 y = 255 5106 r = x * y 5107 if r != 255 { 5108 t.Errorf("1 %s 255 = %d, want 255", "*", r) 5109 } 5110 x = 255 5111 y = 0 5112 r = x * y 5113 if r != 0 { 5114 t.Errorf("255 %s 0 = %d, want 0", "*", r) 5115 } 5116 y = 1 5117 r = x * y 5118 if r != 255 { 5119 t.Errorf("255 %s 1 = %d, want 255", "*", r) 5120 } 5121 y = 255 5122 r = x * y 5123 if r != 1 { 5124 t.Errorf("255 %s 255 = %d, want 1", "*", r) 5125 } 5126 } 5127 func TestConstFolduint8mod(t *testing.T) { 5128 var x, y, r uint8 5129 x = 0 5130 y = 1 5131 r = x % y 5132 if r != 0 { 5133 t.Errorf("0 %s 1 = %d, want 0", "%", r) 5134 } 5135 y = 255 5136 r = x % y 5137 if r != 0 { 5138 t.Errorf("0 %s 255 = %d, want 0", "%", r) 5139 } 5140 x = 1 5141 y = 1 5142 r = x % y 5143 if r != 0 { 5144 t.Errorf("1 %s 1 = %d, want 0", "%", r) 5145 } 5146 y = 255 5147 r = x % y 5148 if r != 1 { 5149 t.Errorf("1 %s 255 = %d, want 1", "%", r) 5150 } 5151 x = 255 5152 y = 1 5153 r = x % y 5154 if r != 0 { 5155 t.Errorf("255 %s 1 = %d, want 0", "%", r) 5156 } 5157 y = 255 5158 r = x % y 5159 if r != 0 { 5160 t.Errorf("255 %s 255 = %d, want 0", "%", r) 5161 } 5162 } 5163 func TestConstFoldint8add(t *testing.T) { 5164 var x, y, r int8 5165 x = -128 5166 y = -128 5167 r = x + y 5168 if r != 0 { 5169 t.Errorf("-128 %s -128 = %d, want 0", "+", r) 5170 } 5171 y = -127 5172 r = x + y 5173 if r != 1 { 5174 t.Errorf("-128 %s -127 = %d, want 1", "+", r) 5175 } 5176 y = -1 5177 r = x + y 5178 if r != 127 { 5179 t.Errorf("-128 %s -1 = %d, want 127", "+", r) 5180 } 5181 y = 0 5182 r = x + y 5183 if r != -128 { 5184 t.Errorf("-128 %s 0 = %d, want -128", "+", r) 5185 } 5186 y = 1 5187 r = x + y 5188 if r != -127 { 5189 t.Errorf("-128 %s 1 = %d, want -127", "+", r) 5190 } 5191 y = 126 5192 r = x + y 5193 if r != -2 { 5194 t.Errorf("-128 %s 126 = %d, want -2", "+", r) 5195 } 5196 y = 127 5197 r = x + y 5198 if r != -1 { 5199 t.Errorf("-128 %s 127 = %d, want -1", "+", r) 5200 } 5201 x = -127 5202 y = -128 5203 r = x + y 5204 if r != 1 { 5205 t.Errorf("-127 %s -128 = %d, want 1", "+", r) 5206 } 5207 y = -127 5208 r = x + y 5209 if r != 2 { 5210 t.Errorf("-127 %s -127 = %d, want 2", "+", r) 5211 } 5212 y = -1 5213 r = x + y 5214 if r != -128 { 5215 t.Errorf("-127 %s -1 = %d, want -128", "+", r) 5216 } 5217 y = 0 5218 r = x + y 5219 if r != -127 { 5220 t.Errorf("-127 %s 0 = %d, want -127", "+", r) 5221 } 5222 y = 1 5223 r = x + y 5224 if r != -126 { 5225 t.Errorf("-127 %s 1 = %d, want -126", "+", r) 5226 } 5227 y = 126 5228 r = x + y 5229 if r != -1 { 5230 t.Errorf("-127 %s 126 = %d, want -1", "+", r) 5231 } 5232 y = 127 5233 r = x + y 5234 if r != 0 { 5235 t.Errorf("-127 %s 127 = %d, want 0", "+", r) 5236 } 5237 x = -1 5238 y = -128 5239 r = x + y 5240 if r != 127 { 5241 t.Errorf("-1 %s -128 = %d, want 127", "+", r) 5242 } 5243 y = -127 5244 r = x + y 5245 if r != -128 { 5246 t.Errorf("-1 %s -127 = %d, want -128", "+", r) 5247 } 5248 y = -1 5249 r = x + y 5250 if r != -2 { 5251 t.Errorf("-1 %s -1 = %d, want -2", "+", r) 5252 } 5253 y = 0 5254 r = x + y 5255 if r != -1 { 5256 t.Errorf("-1 %s 0 = %d, want -1", "+", r) 5257 } 5258 y = 1 5259 r = x + y 5260 if r != 0 { 5261 t.Errorf("-1 %s 1 = %d, want 0", "+", r) 5262 } 5263 y = 126 5264 r = x + y 5265 if r != 125 { 5266 t.Errorf("-1 %s 126 = %d, want 125", "+", r) 5267 } 5268 y = 127 5269 r = x + y 5270 if r != 126 { 5271 t.Errorf("-1 %s 127 = %d, want 126", "+", r) 5272 } 5273 x = 0 5274 y = -128 5275 r = x + y 5276 if r != -128 { 5277 t.Errorf("0 %s -128 = %d, want -128", "+", r) 5278 } 5279 y = -127 5280 r = x + y 5281 if r != -127 { 5282 t.Errorf("0 %s -127 = %d, want -127", "+", r) 5283 } 5284 y = -1 5285 r = x + y 5286 if r != -1 { 5287 t.Errorf("0 %s -1 = %d, want -1", "+", r) 5288 } 5289 y = 0 5290 r = x + y 5291 if r != 0 { 5292 t.Errorf("0 %s 0 = %d, want 0", "+", r) 5293 } 5294 y = 1 5295 r = x + y 5296 if r != 1 { 5297 t.Errorf("0 %s 1 = %d, want 1", "+", r) 5298 } 5299 y = 126 5300 r = x + y 5301 if r != 126 { 5302 t.Errorf("0 %s 126 = %d, want 126", "+", r) 5303 } 5304 y = 127 5305 r = x + y 5306 if r != 127 { 5307 t.Errorf("0 %s 127 = %d, want 127", "+", r) 5308 } 5309 x = 1 5310 y = -128 5311 r = x + y 5312 if r != -127 { 5313 t.Errorf("1 %s -128 = %d, want -127", "+", r) 5314 } 5315 y = -127 5316 r = x + y 5317 if r != -126 { 5318 t.Errorf("1 %s -127 = %d, want -126", "+", r) 5319 } 5320 y = -1 5321 r = x + y 5322 if r != 0 { 5323 t.Errorf("1 %s -1 = %d, want 0", "+", r) 5324 } 5325 y = 0 5326 r = x + y 5327 if r != 1 { 5328 t.Errorf("1 %s 0 = %d, want 1", "+", r) 5329 } 5330 y = 1 5331 r = x + y 5332 if r != 2 { 5333 t.Errorf("1 %s 1 = %d, want 2", "+", r) 5334 } 5335 y = 126 5336 r = x + y 5337 if r != 127 { 5338 t.Errorf("1 %s 126 = %d, want 127", "+", r) 5339 } 5340 y = 127 5341 r = x + y 5342 if r != -128 { 5343 t.Errorf("1 %s 127 = %d, want -128", "+", r) 5344 } 5345 x = 126 5346 y = -128 5347 r = x + y 5348 if r != -2 { 5349 t.Errorf("126 %s -128 = %d, want -2", "+", r) 5350 } 5351 y = -127 5352 r = x + y 5353 if r != -1 { 5354 t.Errorf("126 %s -127 = %d, want -1", "+", r) 5355 } 5356 y = -1 5357 r = x + y 5358 if r != 125 { 5359 t.Errorf("126 %s -1 = %d, want 125", "+", r) 5360 } 5361 y = 0 5362 r = x + y 5363 if r != 126 { 5364 t.Errorf("126 %s 0 = %d, want 126", "+", r) 5365 } 5366 y = 1 5367 r = x + y 5368 if r != 127 { 5369 t.Errorf("126 %s 1 = %d, want 127", "+", r) 5370 } 5371 y = 126 5372 r = x + y 5373 if r != -4 { 5374 t.Errorf("126 %s 126 = %d, want -4", "+", r) 5375 } 5376 y = 127 5377 r = x + y 5378 if r != -3 { 5379 t.Errorf("126 %s 127 = %d, want -3", "+", r) 5380 } 5381 x = 127 5382 y = -128 5383 r = x + y 5384 if r != -1 { 5385 t.Errorf("127 %s -128 = %d, want -1", "+", r) 5386 } 5387 y = -127 5388 r = x + y 5389 if r != 0 { 5390 t.Errorf("127 %s -127 = %d, want 0", "+", r) 5391 } 5392 y = -1 5393 r = x + y 5394 if r != 126 { 5395 t.Errorf("127 %s -1 = %d, want 126", "+", r) 5396 } 5397 y = 0 5398 r = x + y 5399 if r != 127 { 5400 t.Errorf("127 %s 0 = %d, want 127", "+", r) 5401 } 5402 y = 1 5403 r = x + y 5404 if r != -128 { 5405 t.Errorf("127 %s 1 = %d, want -128", "+", r) 5406 } 5407 y = 126 5408 r = x + y 5409 if r != -3 { 5410 t.Errorf("127 %s 126 = %d, want -3", "+", r) 5411 } 5412 y = 127 5413 r = x + y 5414 if r != -2 { 5415 t.Errorf("127 %s 127 = %d, want -2", "+", r) 5416 } 5417 } 5418 func TestConstFoldint8sub(t *testing.T) { 5419 var x, y, r int8 5420 x = -128 5421 y = -128 5422 r = x - y 5423 if r != 0 { 5424 t.Errorf("-128 %s -128 = %d, want 0", "-", r) 5425 } 5426 y = -127 5427 r = x - y 5428 if r != -1 { 5429 t.Errorf("-128 %s -127 = %d, want -1", "-", r) 5430 } 5431 y = -1 5432 r = x - y 5433 if r != -127 { 5434 t.Errorf("-128 %s -1 = %d, want -127", "-", r) 5435 } 5436 y = 0 5437 r = x - y 5438 if r != -128 { 5439 t.Errorf("-128 %s 0 = %d, want -128", "-", r) 5440 } 5441 y = 1 5442 r = x - y 5443 if r != 127 { 5444 t.Errorf("-128 %s 1 = %d, want 127", "-", r) 5445 } 5446 y = 126 5447 r = x - y 5448 if r != 2 { 5449 t.Errorf("-128 %s 126 = %d, want 2", "-", r) 5450 } 5451 y = 127 5452 r = x - y 5453 if r != 1 { 5454 t.Errorf("-128 %s 127 = %d, want 1", "-", r) 5455 } 5456 x = -127 5457 y = -128 5458 r = x - y 5459 if r != 1 { 5460 t.Errorf("-127 %s -128 = %d, want 1", "-", r) 5461 } 5462 y = -127 5463 r = x - y 5464 if r != 0 { 5465 t.Errorf("-127 %s -127 = %d, want 0", "-", r) 5466 } 5467 y = -1 5468 r = x - y 5469 if r != -126 { 5470 t.Errorf("-127 %s -1 = %d, want -126", "-", r) 5471 } 5472 y = 0 5473 r = x - y 5474 if r != -127 { 5475 t.Errorf("-127 %s 0 = %d, want -127", "-", r) 5476 } 5477 y = 1 5478 r = x - y 5479 if r != -128 { 5480 t.Errorf("-127 %s 1 = %d, want -128", "-", r) 5481 } 5482 y = 126 5483 r = x - y 5484 if r != 3 { 5485 t.Errorf("-127 %s 126 = %d, want 3", "-", r) 5486 } 5487 y = 127 5488 r = x - y 5489 if r != 2 { 5490 t.Errorf("-127 %s 127 = %d, want 2", "-", r) 5491 } 5492 x = -1 5493 y = -128 5494 r = x - y 5495 if r != 127 { 5496 t.Errorf("-1 %s -128 = %d, want 127", "-", r) 5497 } 5498 y = -127 5499 r = x - y 5500 if r != 126 { 5501 t.Errorf("-1 %s -127 = %d, want 126", "-", r) 5502 } 5503 y = -1 5504 r = x - y 5505 if r != 0 { 5506 t.Errorf("-1 %s -1 = %d, want 0", "-", r) 5507 } 5508 y = 0 5509 r = x - y 5510 if r != -1 { 5511 t.Errorf("-1 %s 0 = %d, want -1", "-", r) 5512 } 5513 y = 1 5514 r = x - y 5515 if r != -2 { 5516 t.Errorf("-1 %s 1 = %d, want -2", "-", r) 5517 } 5518 y = 126 5519 r = x - y 5520 if r != -127 { 5521 t.Errorf("-1 %s 126 = %d, want -127", "-", r) 5522 } 5523 y = 127 5524 r = x - y 5525 if r != -128 { 5526 t.Errorf("-1 %s 127 = %d, want -128", "-", r) 5527 } 5528 x = 0 5529 y = -128 5530 r = x - y 5531 if r != -128 { 5532 t.Errorf("0 %s -128 = %d, want -128", "-", r) 5533 } 5534 y = -127 5535 r = x - y 5536 if r != 127 { 5537 t.Errorf("0 %s -127 = %d, want 127", "-", r) 5538 } 5539 y = -1 5540 r = x - y 5541 if r != 1 { 5542 t.Errorf("0 %s -1 = %d, want 1", "-", r) 5543 } 5544 y = 0 5545 r = x - y 5546 if r != 0 { 5547 t.Errorf("0 %s 0 = %d, want 0", "-", r) 5548 } 5549 y = 1 5550 r = x - y 5551 if r != -1 { 5552 t.Errorf("0 %s 1 = %d, want -1", "-", r) 5553 } 5554 y = 126 5555 r = x - y 5556 if r != -126 { 5557 t.Errorf("0 %s 126 = %d, want -126", "-", r) 5558 } 5559 y = 127 5560 r = x - y 5561 if r != -127 { 5562 t.Errorf("0 %s 127 = %d, want -127", "-", r) 5563 } 5564 x = 1 5565 y = -128 5566 r = x - y 5567 if r != -127 { 5568 t.Errorf("1 %s -128 = %d, want -127", "-", r) 5569 } 5570 y = -127 5571 r = x - y 5572 if r != -128 { 5573 t.Errorf("1 %s -127 = %d, want -128", "-", r) 5574 } 5575 y = -1 5576 r = x - y 5577 if r != 2 { 5578 t.Errorf("1 %s -1 = %d, want 2", "-", r) 5579 } 5580 y = 0 5581 r = x - y 5582 if r != 1 { 5583 t.Errorf("1 %s 0 = %d, want 1", "-", r) 5584 } 5585 y = 1 5586 r = x - y 5587 if r != 0 { 5588 t.Errorf("1 %s 1 = %d, want 0", "-", r) 5589 } 5590 y = 126 5591 r = x - y 5592 if r != -125 { 5593 t.Errorf("1 %s 126 = %d, want -125", "-", r) 5594 } 5595 y = 127 5596 r = x - y 5597 if r != -126 { 5598 t.Errorf("1 %s 127 = %d, want -126", "-", r) 5599 } 5600 x = 126 5601 y = -128 5602 r = x - y 5603 if r != -2 { 5604 t.Errorf("126 %s -128 = %d, want -2", "-", r) 5605 } 5606 y = -127 5607 r = x - y 5608 if r != -3 { 5609 t.Errorf("126 %s -127 = %d, want -3", "-", r) 5610 } 5611 y = -1 5612 r = x - y 5613 if r != 127 { 5614 t.Errorf("126 %s -1 = %d, want 127", "-", r) 5615 } 5616 y = 0 5617 r = x - y 5618 if r != 126 { 5619 t.Errorf("126 %s 0 = %d, want 126", "-", r) 5620 } 5621 y = 1 5622 r = x - y 5623 if r != 125 { 5624 t.Errorf("126 %s 1 = %d, want 125", "-", r) 5625 } 5626 y = 126 5627 r = x - y 5628 if r != 0 { 5629 t.Errorf("126 %s 126 = %d, want 0", "-", r) 5630 } 5631 y = 127 5632 r = x - y 5633 if r != -1 { 5634 t.Errorf("126 %s 127 = %d, want -1", "-", r) 5635 } 5636 x = 127 5637 y = -128 5638 r = x - y 5639 if r != -1 { 5640 t.Errorf("127 %s -128 = %d, want -1", "-", r) 5641 } 5642 y = -127 5643 r = x - y 5644 if r != -2 { 5645 t.Errorf("127 %s -127 = %d, want -2", "-", r) 5646 } 5647 y = -1 5648 r = x - y 5649 if r != -128 { 5650 t.Errorf("127 %s -1 = %d, want -128", "-", r) 5651 } 5652 y = 0 5653 r = x - y 5654 if r != 127 { 5655 t.Errorf("127 %s 0 = %d, want 127", "-", r) 5656 } 5657 y = 1 5658 r = x - y 5659 if r != 126 { 5660 t.Errorf("127 %s 1 = %d, want 126", "-", r) 5661 } 5662 y = 126 5663 r = x - y 5664 if r != 1 { 5665 t.Errorf("127 %s 126 = %d, want 1", "-", r) 5666 } 5667 y = 127 5668 r = x - y 5669 if r != 0 { 5670 t.Errorf("127 %s 127 = %d, want 0", "-", r) 5671 } 5672 } 5673 func TestConstFoldint8div(t *testing.T) { 5674 var x, y, r int8 5675 x = -128 5676 y = -128 5677 r = x / y 5678 if r != 1 { 5679 t.Errorf("-128 %s -128 = %d, want 1", "/", r) 5680 } 5681 y = -127 5682 r = x / y 5683 if r != 1 { 5684 t.Errorf("-128 %s -127 = %d, want 1", "/", r) 5685 } 5686 y = -1 5687 r = x / y 5688 if r != -128 { 5689 t.Errorf("-128 %s -1 = %d, want -128", "/", r) 5690 } 5691 y = 1 5692 r = x / y 5693 if r != -128 { 5694 t.Errorf("-128 %s 1 = %d, want -128", "/", r) 5695 } 5696 y = 126 5697 r = x / y 5698 if r != -1 { 5699 t.Errorf("-128 %s 126 = %d, want -1", "/", r) 5700 } 5701 y = 127 5702 r = x / y 5703 if r != -1 { 5704 t.Errorf("-128 %s 127 = %d, want -1", "/", r) 5705 } 5706 x = -127 5707 y = -128 5708 r = x / y 5709 if r != 0 { 5710 t.Errorf("-127 %s -128 = %d, want 0", "/", r) 5711 } 5712 y = -127 5713 r = x / y 5714 if r != 1 { 5715 t.Errorf("-127 %s -127 = %d, want 1", "/", r) 5716 } 5717 y = -1 5718 r = x / y 5719 if r != 127 { 5720 t.Errorf("-127 %s -1 = %d, want 127", "/", r) 5721 } 5722 y = 1 5723 r = x / y 5724 if r != -127 { 5725 t.Errorf("-127 %s 1 = %d, want -127", "/", r) 5726 } 5727 y = 126 5728 r = x / y 5729 if r != -1 { 5730 t.Errorf("-127 %s 126 = %d, want -1", "/", r) 5731 } 5732 y = 127 5733 r = x / y 5734 if r != -1 { 5735 t.Errorf("-127 %s 127 = %d, want -1", "/", r) 5736 } 5737 x = -1 5738 y = -128 5739 r = x / y 5740 if r != 0 { 5741 t.Errorf("-1 %s -128 = %d, want 0", "/", r) 5742 } 5743 y = -127 5744 r = x / y 5745 if r != 0 { 5746 t.Errorf("-1 %s -127 = %d, want 0", "/", r) 5747 } 5748 y = -1 5749 r = x / y 5750 if r != 1 { 5751 t.Errorf("-1 %s -1 = %d, want 1", "/", r) 5752 } 5753 y = 1 5754 r = x / y 5755 if r != -1 { 5756 t.Errorf("-1 %s 1 = %d, want -1", "/", r) 5757 } 5758 y = 126 5759 r = x / y 5760 if r != 0 { 5761 t.Errorf("-1 %s 126 = %d, want 0", "/", r) 5762 } 5763 y = 127 5764 r = x / y 5765 if r != 0 { 5766 t.Errorf("-1 %s 127 = %d, want 0", "/", r) 5767 } 5768 x = 0 5769 y = -128 5770 r = x / y 5771 if r != 0 { 5772 t.Errorf("0 %s -128 = %d, want 0", "/", r) 5773 } 5774 y = -127 5775 r = x / y 5776 if r != 0 { 5777 t.Errorf("0 %s -127 = %d, want 0", "/", r) 5778 } 5779 y = -1 5780 r = x / y 5781 if r != 0 { 5782 t.Errorf("0 %s -1 = %d, want 0", "/", r) 5783 } 5784 y = 1 5785 r = x / y 5786 if r != 0 { 5787 t.Errorf("0 %s 1 = %d, want 0", "/", r) 5788 } 5789 y = 126 5790 r = x / y 5791 if r != 0 { 5792 t.Errorf("0 %s 126 = %d, want 0", "/", r) 5793 } 5794 y = 127 5795 r = x / y 5796 if r != 0 { 5797 t.Errorf("0 %s 127 = %d, want 0", "/", r) 5798 } 5799 x = 1 5800 y = -128 5801 r = x / y 5802 if r != 0 { 5803 t.Errorf("1 %s -128 = %d, want 0", "/", r) 5804 } 5805 y = -127 5806 r = x / y 5807 if r != 0 { 5808 t.Errorf("1 %s -127 = %d, want 0", "/", r) 5809 } 5810 y = -1 5811 r = x / y 5812 if r != -1 { 5813 t.Errorf("1 %s -1 = %d, want -1", "/", r) 5814 } 5815 y = 1 5816 r = x / y 5817 if r != 1 { 5818 t.Errorf("1 %s 1 = %d, want 1", "/", r) 5819 } 5820 y = 126 5821 r = x / y 5822 if r != 0 { 5823 t.Errorf("1 %s 126 = %d, want 0", "/", r) 5824 } 5825 y = 127 5826 r = x / y 5827 if r != 0 { 5828 t.Errorf("1 %s 127 = %d, want 0", "/", r) 5829 } 5830 x = 126 5831 y = -128 5832 r = x / y 5833 if r != 0 { 5834 t.Errorf("126 %s -128 = %d, want 0", "/", r) 5835 } 5836 y = -127 5837 r = x / y 5838 if r != 0 { 5839 t.Errorf("126 %s -127 = %d, want 0", "/", r) 5840 } 5841 y = -1 5842 r = x / y 5843 if r != -126 { 5844 t.Errorf("126 %s -1 = %d, want -126", "/", r) 5845 } 5846 y = 1 5847 r = x / y 5848 if r != 126 { 5849 t.Errorf("126 %s 1 = %d, want 126", "/", r) 5850 } 5851 y = 126 5852 r = x / y 5853 if r != 1 { 5854 t.Errorf("126 %s 126 = %d, want 1", "/", r) 5855 } 5856 y = 127 5857 r = x / y 5858 if r != 0 { 5859 t.Errorf("126 %s 127 = %d, want 0", "/", r) 5860 } 5861 x = 127 5862 y = -128 5863 r = x / y 5864 if r != 0 { 5865 t.Errorf("127 %s -128 = %d, want 0", "/", r) 5866 } 5867 y = -127 5868 r = x / y 5869 if r != -1 { 5870 t.Errorf("127 %s -127 = %d, want -1", "/", r) 5871 } 5872 y = -1 5873 r = x / y 5874 if r != -127 { 5875 t.Errorf("127 %s -1 = %d, want -127", "/", r) 5876 } 5877 y = 1 5878 r = x / y 5879 if r != 127 { 5880 t.Errorf("127 %s 1 = %d, want 127", "/", r) 5881 } 5882 y = 126 5883 r = x / y 5884 if r != 1 { 5885 t.Errorf("127 %s 126 = %d, want 1", "/", r) 5886 } 5887 y = 127 5888 r = x / y 5889 if r != 1 { 5890 t.Errorf("127 %s 127 = %d, want 1", "/", r) 5891 } 5892 } 5893 func TestConstFoldint8mul(t *testing.T) { 5894 var x, y, r int8 5895 x = -128 5896 y = -128 5897 r = x * y 5898 if r != 0 { 5899 t.Errorf("-128 %s -128 = %d, want 0", "*", r) 5900 } 5901 y = -127 5902 r = x * y 5903 if r != -128 { 5904 t.Errorf("-128 %s -127 = %d, want -128", "*", r) 5905 } 5906 y = -1 5907 r = x * y 5908 if r != -128 { 5909 t.Errorf("-128 %s -1 = %d, want -128", "*", r) 5910 } 5911 y = 0 5912 r = x * y 5913 if r != 0 { 5914 t.Errorf("-128 %s 0 = %d, want 0", "*", r) 5915 } 5916 y = 1 5917 r = x * y 5918 if r != -128 { 5919 t.Errorf("-128 %s 1 = %d, want -128", "*", r) 5920 } 5921 y = 126 5922 r = x * y 5923 if r != 0 { 5924 t.Errorf("-128 %s 126 = %d, want 0", "*", r) 5925 } 5926 y = 127 5927 r = x * y 5928 if r != -128 { 5929 t.Errorf("-128 %s 127 = %d, want -128", "*", r) 5930 } 5931 x = -127 5932 y = -128 5933 r = x * y 5934 if r != -128 { 5935 t.Errorf("-127 %s -128 = %d, want -128", "*", r) 5936 } 5937 y = -127 5938 r = x * y 5939 if r != 1 { 5940 t.Errorf("-127 %s -127 = %d, want 1", "*", r) 5941 } 5942 y = -1 5943 r = x * y 5944 if r != 127 { 5945 t.Errorf("-127 %s -1 = %d, want 127", "*", r) 5946 } 5947 y = 0 5948 r = x * y 5949 if r != 0 { 5950 t.Errorf("-127 %s 0 = %d, want 0", "*", r) 5951 } 5952 y = 1 5953 r = x * y 5954 if r != -127 { 5955 t.Errorf("-127 %s 1 = %d, want -127", "*", r) 5956 } 5957 y = 126 5958 r = x * y 5959 if r != 126 { 5960 t.Errorf("-127 %s 126 = %d, want 126", "*", r) 5961 } 5962 y = 127 5963 r = x * y 5964 if r != -1 { 5965 t.Errorf("-127 %s 127 = %d, want -1", "*", r) 5966 } 5967 x = -1 5968 y = -128 5969 r = x * y 5970 if r != -128 { 5971 t.Errorf("-1 %s -128 = %d, want -128", "*", r) 5972 } 5973 y = -127 5974 r = x * y 5975 if r != 127 { 5976 t.Errorf("-1 %s -127 = %d, want 127", "*", r) 5977 } 5978 y = -1 5979 r = x * y 5980 if r != 1 { 5981 t.Errorf("-1 %s -1 = %d, want 1", "*", r) 5982 } 5983 y = 0 5984 r = x * y 5985 if r != 0 { 5986 t.Errorf("-1 %s 0 = %d, want 0", "*", r) 5987 } 5988 y = 1 5989 r = x * y 5990 if r != -1 { 5991 t.Errorf("-1 %s 1 = %d, want -1", "*", r) 5992 } 5993 y = 126 5994 r = x * y 5995 if r != -126 { 5996 t.Errorf("-1 %s 126 = %d, want -126", "*", r) 5997 } 5998 y = 127 5999 r = x * y 6000 if r != -127 { 6001 t.Errorf("-1 %s 127 = %d, want -127", "*", r) 6002 } 6003 x = 0 6004 y = -128 6005 r = x * y 6006 if r != 0 { 6007 t.Errorf("0 %s -128 = %d, want 0", "*", r) 6008 } 6009 y = -127 6010 r = x * y 6011 if r != 0 { 6012 t.Errorf("0 %s -127 = %d, want 0", "*", r) 6013 } 6014 y = -1 6015 r = x * y 6016 if r != 0 { 6017 t.Errorf("0 %s -1 = %d, want 0", "*", r) 6018 } 6019 y = 0 6020 r = x * y 6021 if r != 0 { 6022 t.Errorf("0 %s 0 = %d, want 0", "*", r) 6023 } 6024 y = 1 6025 r = x * y 6026 if r != 0 { 6027 t.Errorf("0 %s 1 = %d, want 0", "*", r) 6028 } 6029 y = 126 6030 r = x * y 6031 if r != 0 { 6032 t.Errorf("0 %s 126 = %d, want 0", "*", r) 6033 } 6034 y = 127 6035 r = x * y 6036 if r != 0 { 6037 t.Errorf("0 %s 127 = %d, want 0", "*", r) 6038 } 6039 x = 1 6040 y = -128 6041 r = x * y 6042 if r != -128 { 6043 t.Errorf("1 %s -128 = %d, want -128", "*", r) 6044 } 6045 y = -127 6046 r = x * y 6047 if r != -127 { 6048 t.Errorf("1 %s -127 = %d, want -127", "*", r) 6049 } 6050 y = -1 6051 r = x * y 6052 if r != -1 { 6053 t.Errorf("1 %s -1 = %d, want -1", "*", r) 6054 } 6055 y = 0 6056 r = x * y 6057 if r != 0 { 6058 t.Errorf("1 %s 0 = %d, want 0", "*", r) 6059 } 6060 y = 1 6061 r = x * y 6062 if r != 1 { 6063 t.Errorf("1 %s 1 = %d, want 1", "*", r) 6064 } 6065 y = 126 6066 r = x * y 6067 if r != 126 { 6068 t.Errorf("1 %s 126 = %d, want 126", "*", r) 6069 } 6070 y = 127 6071 r = x * y 6072 if r != 127 { 6073 t.Errorf("1 %s 127 = %d, want 127", "*", r) 6074 } 6075 x = 126 6076 y = -128 6077 r = x * y 6078 if r != 0 { 6079 t.Errorf("126 %s -128 = %d, want 0", "*", r) 6080 } 6081 y = -127 6082 r = x * y 6083 if r != 126 { 6084 t.Errorf("126 %s -127 = %d, want 126", "*", r) 6085 } 6086 y = -1 6087 r = x * y 6088 if r != -126 { 6089 t.Errorf("126 %s -1 = %d, want -126", "*", r) 6090 } 6091 y = 0 6092 r = x * y 6093 if r != 0 { 6094 t.Errorf("126 %s 0 = %d, want 0", "*", r) 6095 } 6096 y = 1 6097 r = x * y 6098 if r != 126 { 6099 t.Errorf("126 %s 1 = %d, want 126", "*", r) 6100 } 6101 y = 126 6102 r = x * y 6103 if r != 4 { 6104 t.Errorf("126 %s 126 = %d, want 4", "*", r) 6105 } 6106 y = 127 6107 r = x * y 6108 if r != -126 { 6109 t.Errorf("126 %s 127 = %d, want -126", "*", r) 6110 } 6111 x = 127 6112 y = -128 6113 r = x * y 6114 if r != -128 { 6115 t.Errorf("127 %s -128 = %d, want -128", "*", r) 6116 } 6117 y = -127 6118 r = x * y 6119 if r != -1 { 6120 t.Errorf("127 %s -127 = %d, want -1", "*", r) 6121 } 6122 y = -1 6123 r = x * y 6124 if r != -127 { 6125 t.Errorf("127 %s -1 = %d, want -127", "*", r) 6126 } 6127 y = 0 6128 r = x * y 6129 if r != 0 { 6130 t.Errorf("127 %s 0 = %d, want 0", "*", r) 6131 } 6132 y = 1 6133 r = x * y 6134 if r != 127 { 6135 t.Errorf("127 %s 1 = %d, want 127", "*", r) 6136 } 6137 y = 126 6138 r = x * y 6139 if r != -126 { 6140 t.Errorf("127 %s 126 = %d, want -126", "*", r) 6141 } 6142 y = 127 6143 r = x * y 6144 if r != 1 { 6145 t.Errorf("127 %s 127 = %d, want 1", "*", r) 6146 } 6147 } 6148 func TestConstFoldint8mod(t *testing.T) { 6149 var x, y, r int8 6150 x = -128 6151 y = -128 6152 r = x % y 6153 if r != 0 { 6154 t.Errorf("-128 %s -128 = %d, want 0", "%", r) 6155 } 6156 y = -127 6157 r = x % y 6158 if r != -1 { 6159 t.Errorf("-128 %s -127 = %d, want -1", "%", r) 6160 } 6161 y = -1 6162 r = x % y 6163 if r != 0 { 6164 t.Errorf("-128 %s -1 = %d, want 0", "%", r) 6165 } 6166 y = 1 6167 r = x % y 6168 if r != 0 { 6169 t.Errorf("-128 %s 1 = %d, want 0", "%", r) 6170 } 6171 y = 126 6172 r = x % y 6173 if r != -2 { 6174 t.Errorf("-128 %s 126 = %d, want -2", "%", r) 6175 } 6176 y = 127 6177 r = x % y 6178 if r != -1 { 6179 t.Errorf("-128 %s 127 = %d, want -1", "%", r) 6180 } 6181 x = -127 6182 y = -128 6183 r = x % y 6184 if r != -127 { 6185 t.Errorf("-127 %s -128 = %d, want -127", "%", r) 6186 } 6187 y = -127 6188 r = x % y 6189 if r != 0 { 6190 t.Errorf("-127 %s -127 = %d, want 0", "%", r) 6191 } 6192 y = -1 6193 r = x % y 6194 if r != 0 { 6195 t.Errorf("-127 %s -1 = %d, want 0", "%", r) 6196 } 6197 y = 1 6198 r = x % y 6199 if r != 0 { 6200 t.Errorf("-127 %s 1 = %d, want 0", "%", r) 6201 } 6202 y = 126 6203 r = x % y 6204 if r != -1 { 6205 t.Errorf("-127 %s 126 = %d, want -1", "%", r) 6206 } 6207 y = 127 6208 r = x % y 6209 if r != 0 { 6210 t.Errorf("-127 %s 127 = %d, want 0", "%", r) 6211 } 6212 x = -1 6213 y = -128 6214 r = x % y 6215 if r != -1 { 6216 t.Errorf("-1 %s -128 = %d, want -1", "%", r) 6217 } 6218 y = -127 6219 r = x % y 6220 if r != -1 { 6221 t.Errorf("-1 %s -127 = %d, want -1", "%", r) 6222 } 6223 y = -1 6224 r = x % y 6225 if r != 0 { 6226 t.Errorf("-1 %s -1 = %d, want 0", "%", r) 6227 } 6228 y = 1 6229 r = x % y 6230 if r != 0 { 6231 t.Errorf("-1 %s 1 = %d, want 0", "%", r) 6232 } 6233 y = 126 6234 r = x % y 6235 if r != -1 { 6236 t.Errorf("-1 %s 126 = %d, want -1", "%", r) 6237 } 6238 y = 127 6239 r = x % y 6240 if r != -1 { 6241 t.Errorf("-1 %s 127 = %d, want -1", "%", r) 6242 } 6243 x = 0 6244 y = -128 6245 r = x % y 6246 if r != 0 { 6247 t.Errorf("0 %s -128 = %d, want 0", "%", r) 6248 } 6249 y = -127 6250 r = x % y 6251 if r != 0 { 6252 t.Errorf("0 %s -127 = %d, want 0", "%", r) 6253 } 6254 y = -1 6255 r = x % y 6256 if r != 0 { 6257 t.Errorf("0 %s -1 = %d, want 0", "%", r) 6258 } 6259 y = 1 6260 r = x % y 6261 if r != 0 { 6262 t.Errorf("0 %s 1 = %d, want 0", "%", r) 6263 } 6264 y = 126 6265 r = x % y 6266 if r != 0 { 6267 t.Errorf("0 %s 126 = %d, want 0", "%", r) 6268 } 6269 y = 127 6270 r = x % y 6271 if r != 0 { 6272 t.Errorf("0 %s 127 = %d, want 0", "%", r) 6273 } 6274 x = 1 6275 y = -128 6276 r = x % y 6277 if r != 1 { 6278 t.Errorf("1 %s -128 = %d, want 1", "%", r) 6279 } 6280 y = -127 6281 r = x % y 6282 if r != 1 { 6283 t.Errorf("1 %s -127 = %d, want 1", "%", r) 6284 } 6285 y = -1 6286 r = x % y 6287 if r != 0 { 6288 t.Errorf("1 %s -1 = %d, want 0", "%", r) 6289 } 6290 y = 1 6291 r = x % y 6292 if r != 0 { 6293 t.Errorf("1 %s 1 = %d, want 0", "%", r) 6294 } 6295 y = 126 6296 r = x % y 6297 if r != 1 { 6298 t.Errorf("1 %s 126 = %d, want 1", "%", r) 6299 } 6300 y = 127 6301 r = x % y 6302 if r != 1 { 6303 t.Errorf("1 %s 127 = %d, want 1", "%", r) 6304 } 6305 x = 126 6306 y = -128 6307 r = x % y 6308 if r != 126 { 6309 t.Errorf("126 %s -128 = %d, want 126", "%", r) 6310 } 6311 y = -127 6312 r = x % y 6313 if r != 126 { 6314 t.Errorf("126 %s -127 = %d, want 126", "%", r) 6315 } 6316 y = -1 6317 r = x % y 6318 if r != 0 { 6319 t.Errorf("126 %s -1 = %d, want 0", "%", r) 6320 } 6321 y = 1 6322 r = x % y 6323 if r != 0 { 6324 t.Errorf("126 %s 1 = %d, want 0", "%", r) 6325 } 6326 y = 126 6327 r = x % y 6328 if r != 0 { 6329 t.Errorf("126 %s 126 = %d, want 0", "%", r) 6330 } 6331 y = 127 6332 r = x % y 6333 if r != 126 { 6334 t.Errorf("126 %s 127 = %d, want 126", "%", r) 6335 } 6336 x = 127 6337 y = -128 6338 r = x % y 6339 if r != 127 { 6340 t.Errorf("127 %s -128 = %d, want 127", "%", r) 6341 } 6342 y = -127 6343 r = x % y 6344 if r != 0 { 6345 t.Errorf("127 %s -127 = %d, want 0", "%", r) 6346 } 6347 y = -1 6348 r = x % y 6349 if r != 0 { 6350 t.Errorf("127 %s -1 = %d, want 0", "%", r) 6351 } 6352 y = 1 6353 r = x % y 6354 if r != 0 { 6355 t.Errorf("127 %s 1 = %d, want 0", "%", r) 6356 } 6357 y = 126 6358 r = x % y 6359 if r != 1 { 6360 t.Errorf("127 %s 126 = %d, want 1", "%", r) 6361 } 6362 y = 127 6363 r = x % y 6364 if r != 0 { 6365 t.Errorf("127 %s 127 = %d, want 0", "%", r) 6366 } 6367 } 6368 func TestConstFolduint64uint64lsh(t *testing.T) { 6369 var x, r uint64 6370 var y uint64 6371 x = 0 6372 y = 0 6373 r = x << y 6374 if r != 0 { 6375 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 6376 } 6377 y = 1 6378 r = x << y 6379 if r != 0 { 6380 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 6381 } 6382 y = 4294967296 6383 r = x << y 6384 if r != 0 { 6385 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 6386 } 6387 y = 18446744073709551615 6388 r = x << y 6389 if r != 0 { 6390 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 6391 } 6392 x = 1 6393 y = 0 6394 r = x << y 6395 if r != 1 { 6396 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 6397 } 6398 y = 1 6399 r = x << y 6400 if r != 2 { 6401 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 6402 } 6403 y = 4294967296 6404 r = x << y 6405 if r != 0 { 6406 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 6407 } 6408 y = 18446744073709551615 6409 r = x << y 6410 if r != 0 { 6411 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 6412 } 6413 x = 4294967296 6414 y = 0 6415 r = x << y 6416 if r != 4294967296 { 6417 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 6418 } 6419 y = 1 6420 r = x << y 6421 if r != 8589934592 { 6422 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 6423 } 6424 y = 4294967296 6425 r = x << y 6426 if r != 0 { 6427 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "<<", r) 6428 } 6429 y = 18446744073709551615 6430 r = x << y 6431 if r != 0 { 6432 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", "<<", r) 6433 } 6434 x = 18446744073709551615 6435 y = 0 6436 r = x << y 6437 if r != 18446744073709551615 { 6438 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "<<", r) 6439 } 6440 y = 1 6441 r = x << y 6442 if r != 18446744073709551614 { 6443 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "<<", r) 6444 } 6445 y = 4294967296 6446 r = x << y 6447 if r != 0 { 6448 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 0", "<<", r) 6449 } 6450 y = 18446744073709551615 6451 r = x << y 6452 if r != 0 { 6453 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 0", "<<", r) 6454 } 6455 } 6456 func TestConstFolduint64uint64rsh(t *testing.T) { 6457 var x, r uint64 6458 var y uint64 6459 x = 0 6460 y = 0 6461 r = x >> y 6462 if r != 0 { 6463 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 6464 } 6465 y = 1 6466 r = x >> y 6467 if r != 0 { 6468 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 6469 } 6470 y = 4294967296 6471 r = x >> y 6472 if r != 0 { 6473 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 6474 } 6475 y = 18446744073709551615 6476 r = x >> y 6477 if r != 0 { 6478 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 6479 } 6480 x = 1 6481 y = 0 6482 r = x >> y 6483 if r != 1 { 6484 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 6485 } 6486 y = 1 6487 r = x >> y 6488 if r != 0 { 6489 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 6490 } 6491 y = 4294967296 6492 r = x >> y 6493 if r != 0 { 6494 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 6495 } 6496 y = 18446744073709551615 6497 r = x >> y 6498 if r != 0 { 6499 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 6500 } 6501 x = 4294967296 6502 y = 0 6503 r = x >> y 6504 if r != 4294967296 { 6505 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 6506 } 6507 y = 1 6508 r = x >> y 6509 if r != 2147483648 { 6510 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 6511 } 6512 y = 4294967296 6513 r = x >> y 6514 if r != 0 { 6515 t.Errorf("4294967296 %s 4294967296 = %d, want 0", ">>", r) 6516 } 6517 y = 18446744073709551615 6518 r = x >> y 6519 if r != 0 { 6520 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", ">>", r) 6521 } 6522 x = 18446744073709551615 6523 y = 0 6524 r = x >> y 6525 if r != 18446744073709551615 { 6526 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", ">>", r) 6527 } 6528 y = 1 6529 r = x >> y 6530 if r != 9223372036854775807 { 6531 t.Errorf("18446744073709551615 %s 1 = %d, want 9223372036854775807", ">>", r) 6532 } 6533 y = 4294967296 6534 r = x >> y 6535 if r != 0 { 6536 t.Errorf("18446744073709551615 %s 4294967296 = %d, want 0", ">>", r) 6537 } 6538 y = 18446744073709551615 6539 r = x >> y 6540 if r != 0 { 6541 t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 0", ">>", r) 6542 } 6543 } 6544 func TestConstFolduint64uint32lsh(t *testing.T) { 6545 var x, r uint64 6546 var y uint32 6547 x = 0 6548 y = 0 6549 r = x << y 6550 if r != 0 { 6551 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 6552 } 6553 y = 1 6554 r = x << y 6555 if r != 0 { 6556 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 6557 } 6558 y = 4294967295 6559 r = x << y 6560 if r != 0 { 6561 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 6562 } 6563 x = 1 6564 y = 0 6565 r = x << y 6566 if r != 1 { 6567 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 6568 } 6569 y = 1 6570 r = x << y 6571 if r != 2 { 6572 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 6573 } 6574 y = 4294967295 6575 r = x << y 6576 if r != 0 { 6577 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 6578 } 6579 x = 4294967296 6580 y = 0 6581 r = x << y 6582 if r != 4294967296 { 6583 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 6584 } 6585 y = 1 6586 r = x << y 6587 if r != 8589934592 { 6588 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 6589 } 6590 y = 4294967295 6591 r = x << y 6592 if r != 0 { 6593 t.Errorf("4294967296 %s 4294967295 = %d, want 0", "<<", r) 6594 } 6595 x = 18446744073709551615 6596 y = 0 6597 r = x << y 6598 if r != 18446744073709551615 { 6599 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "<<", r) 6600 } 6601 y = 1 6602 r = x << y 6603 if r != 18446744073709551614 { 6604 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "<<", r) 6605 } 6606 y = 4294967295 6607 r = x << y 6608 if r != 0 { 6609 t.Errorf("18446744073709551615 %s 4294967295 = %d, want 0", "<<", r) 6610 } 6611 } 6612 func TestConstFolduint64uint32rsh(t *testing.T) { 6613 var x, r uint64 6614 var y uint32 6615 x = 0 6616 y = 0 6617 r = x >> y 6618 if r != 0 { 6619 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 6620 } 6621 y = 1 6622 r = x >> y 6623 if r != 0 { 6624 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 6625 } 6626 y = 4294967295 6627 r = x >> y 6628 if r != 0 { 6629 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 6630 } 6631 x = 1 6632 y = 0 6633 r = x >> y 6634 if r != 1 { 6635 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 6636 } 6637 y = 1 6638 r = x >> y 6639 if r != 0 { 6640 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 6641 } 6642 y = 4294967295 6643 r = x >> y 6644 if r != 0 { 6645 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 6646 } 6647 x = 4294967296 6648 y = 0 6649 r = x >> y 6650 if r != 4294967296 { 6651 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 6652 } 6653 y = 1 6654 r = x >> y 6655 if r != 2147483648 { 6656 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 6657 } 6658 y = 4294967295 6659 r = x >> y 6660 if r != 0 { 6661 t.Errorf("4294967296 %s 4294967295 = %d, want 0", ">>", r) 6662 } 6663 x = 18446744073709551615 6664 y = 0 6665 r = x >> y 6666 if r != 18446744073709551615 { 6667 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", ">>", r) 6668 } 6669 y = 1 6670 r = x >> y 6671 if r != 9223372036854775807 { 6672 t.Errorf("18446744073709551615 %s 1 = %d, want 9223372036854775807", ">>", r) 6673 } 6674 y = 4294967295 6675 r = x >> y 6676 if r != 0 { 6677 t.Errorf("18446744073709551615 %s 4294967295 = %d, want 0", ">>", r) 6678 } 6679 } 6680 func TestConstFolduint64uint16lsh(t *testing.T) { 6681 var x, r uint64 6682 var y uint16 6683 x = 0 6684 y = 0 6685 r = x << y 6686 if r != 0 { 6687 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 6688 } 6689 y = 1 6690 r = x << y 6691 if r != 0 { 6692 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 6693 } 6694 y = 65535 6695 r = x << y 6696 if r != 0 { 6697 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 6698 } 6699 x = 1 6700 y = 0 6701 r = x << y 6702 if r != 1 { 6703 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 6704 } 6705 y = 1 6706 r = x << y 6707 if r != 2 { 6708 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 6709 } 6710 y = 65535 6711 r = x << y 6712 if r != 0 { 6713 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 6714 } 6715 x = 4294967296 6716 y = 0 6717 r = x << y 6718 if r != 4294967296 { 6719 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 6720 } 6721 y = 1 6722 r = x << y 6723 if r != 8589934592 { 6724 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 6725 } 6726 y = 65535 6727 r = x << y 6728 if r != 0 { 6729 t.Errorf("4294967296 %s 65535 = %d, want 0", "<<", r) 6730 } 6731 x = 18446744073709551615 6732 y = 0 6733 r = x << y 6734 if r != 18446744073709551615 { 6735 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "<<", r) 6736 } 6737 y = 1 6738 r = x << y 6739 if r != 18446744073709551614 { 6740 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "<<", r) 6741 } 6742 y = 65535 6743 r = x << y 6744 if r != 0 { 6745 t.Errorf("18446744073709551615 %s 65535 = %d, want 0", "<<", r) 6746 } 6747 } 6748 func TestConstFolduint64uint16rsh(t *testing.T) { 6749 var x, r uint64 6750 var y uint16 6751 x = 0 6752 y = 0 6753 r = x >> y 6754 if r != 0 { 6755 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 6756 } 6757 y = 1 6758 r = x >> y 6759 if r != 0 { 6760 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 6761 } 6762 y = 65535 6763 r = x >> y 6764 if r != 0 { 6765 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 6766 } 6767 x = 1 6768 y = 0 6769 r = x >> y 6770 if r != 1 { 6771 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 6772 } 6773 y = 1 6774 r = x >> y 6775 if r != 0 { 6776 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 6777 } 6778 y = 65535 6779 r = x >> y 6780 if r != 0 { 6781 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 6782 } 6783 x = 4294967296 6784 y = 0 6785 r = x >> y 6786 if r != 4294967296 { 6787 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 6788 } 6789 y = 1 6790 r = x >> y 6791 if r != 2147483648 { 6792 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 6793 } 6794 y = 65535 6795 r = x >> y 6796 if r != 0 { 6797 t.Errorf("4294967296 %s 65535 = %d, want 0", ">>", r) 6798 } 6799 x = 18446744073709551615 6800 y = 0 6801 r = x >> y 6802 if r != 18446744073709551615 { 6803 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", ">>", r) 6804 } 6805 y = 1 6806 r = x >> y 6807 if r != 9223372036854775807 { 6808 t.Errorf("18446744073709551615 %s 1 = %d, want 9223372036854775807", ">>", r) 6809 } 6810 y = 65535 6811 r = x >> y 6812 if r != 0 { 6813 t.Errorf("18446744073709551615 %s 65535 = %d, want 0", ">>", r) 6814 } 6815 } 6816 func TestConstFolduint64uint8lsh(t *testing.T) { 6817 var x, r uint64 6818 var y uint8 6819 x = 0 6820 y = 0 6821 r = x << y 6822 if r != 0 { 6823 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 6824 } 6825 y = 1 6826 r = x << y 6827 if r != 0 { 6828 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 6829 } 6830 y = 255 6831 r = x << y 6832 if r != 0 { 6833 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 6834 } 6835 x = 1 6836 y = 0 6837 r = x << y 6838 if r != 1 { 6839 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 6840 } 6841 y = 1 6842 r = x << y 6843 if r != 2 { 6844 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 6845 } 6846 y = 255 6847 r = x << y 6848 if r != 0 { 6849 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 6850 } 6851 x = 4294967296 6852 y = 0 6853 r = x << y 6854 if r != 4294967296 { 6855 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 6856 } 6857 y = 1 6858 r = x << y 6859 if r != 8589934592 { 6860 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 6861 } 6862 y = 255 6863 r = x << y 6864 if r != 0 { 6865 t.Errorf("4294967296 %s 255 = %d, want 0", "<<", r) 6866 } 6867 x = 18446744073709551615 6868 y = 0 6869 r = x << y 6870 if r != 18446744073709551615 { 6871 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "<<", r) 6872 } 6873 y = 1 6874 r = x << y 6875 if r != 18446744073709551614 { 6876 t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "<<", r) 6877 } 6878 y = 255 6879 r = x << y 6880 if r != 0 { 6881 t.Errorf("18446744073709551615 %s 255 = %d, want 0", "<<", r) 6882 } 6883 } 6884 func TestConstFolduint64uint8rsh(t *testing.T) { 6885 var x, r uint64 6886 var y uint8 6887 x = 0 6888 y = 0 6889 r = x >> y 6890 if r != 0 { 6891 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 6892 } 6893 y = 1 6894 r = x >> y 6895 if r != 0 { 6896 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 6897 } 6898 y = 255 6899 r = x >> y 6900 if r != 0 { 6901 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 6902 } 6903 x = 1 6904 y = 0 6905 r = x >> y 6906 if r != 1 { 6907 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 6908 } 6909 y = 1 6910 r = x >> y 6911 if r != 0 { 6912 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 6913 } 6914 y = 255 6915 r = x >> y 6916 if r != 0 { 6917 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 6918 } 6919 x = 4294967296 6920 y = 0 6921 r = x >> y 6922 if r != 4294967296 { 6923 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 6924 } 6925 y = 1 6926 r = x >> y 6927 if r != 2147483648 { 6928 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 6929 } 6930 y = 255 6931 r = x >> y 6932 if r != 0 { 6933 t.Errorf("4294967296 %s 255 = %d, want 0", ">>", r) 6934 } 6935 x = 18446744073709551615 6936 y = 0 6937 r = x >> y 6938 if r != 18446744073709551615 { 6939 t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", ">>", r) 6940 } 6941 y = 1 6942 r = x >> y 6943 if r != 9223372036854775807 { 6944 t.Errorf("18446744073709551615 %s 1 = %d, want 9223372036854775807", ">>", r) 6945 } 6946 y = 255 6947 r = x >> y 6948 if r != 0 { 6949 t.Errorf("18446744073709551615 %s 255 = %d, want 0", ">>", r) 6950 } 6951 } 6952 func TestConstFoldint64uint64lsh(t *testing.T) { 6953 var x, r int64 6954 var y uint64 6955 x = -9223372036854775808 6956 y = 0 6957 r = x << y 6958 if r != -9223372036854775808 { 6959 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "<<", r) 6960 } 6961 y = 1 6962 r = x << y 6963 if r != 0 { 6964 t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "<<", r) 6965 } 6966 y = 4294967296 6967 r = x << y 6968 if r != 0 { 6969 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 0", "<<", r) 6970 } 6971 y = 18446744073709551615 6972 r = x << y 6973 if r != 0 { 6974 t.Errorf("-9223372036854775808 %s 18446744073709551615 = %d, want 0", "<<", r) 6975 } 6976 x = -9223372036854775807 6977 y = 0 6978 r = x << y 6979 if r != -9223372036854775807 { 6980 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "<<", r) 6981 } 6982 y = 1 6983 r = x << y 6984 if r != 2 { 6985 t.Errorf("-9223372036854775807 %s 1 = %d, want 2", "<<", r) 6986 } 6987 y = 4294967296 6988 r = x << y 6989 if r != 0 { 6990 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want 0", "<<", r) 6991 } 6992 y = 18446744073709551615 6993 r = x << y 6994 if r != 0 { 6995 t.Errorf("-9223372036854775807 %s 18446744073709551615 = %d, want 0", "<<", r) 6996 } 6997 x = -4294967296 6998 y = 0 6999 r = x << y 7000 if r != -4294967296 { 7001 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "<<", r) 7002 } 7003 y = 1 7004 r = x << y 7005 if r != -8589934592 { 7006 t.Errorf("-4294967296 %s 1 = %d, want -8589934592", "<<", r) 7007 } 7008 y = 4294967296 7009 r = x << y 7010 if r != 0 { 7011 t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "<<", r) 7012 } 7013 y = 18446744073709551615 7014 r = x << y 7015 if r != 0 { 7016 t.Errorf("-4294967296 %s 18446744073709551615 = %d, want 0", "<<", r) 7017 } 7018 x = -1 7019 y = 0 7020 r = x << y 7021 if r != -1 { 7022 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 7023 } 7024 y = 1 7025 r = x << y 7026 if r != -2 { 7027 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 7028 } 7029 y = 4294967296 7030 r = x << y 7031 if r != 0 { 7032 t.Errorf("-1 %s 4294967296 = %d, want 0", "<<", r) 7033 } 7034 y = 18446744073709551615 7035 r = x << y 7036 if r != 0 { 7037 t.Errorf("-1 %s 18446744073709551615 = %d, want 0", "<<", r) 7038 } 7039 x = 0 7040 y = 0 7041 r = x << y 7042 if r != 0 { 7043 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 7044 } 7045 y = 1 7046 r = x << y 7047 if r != 0 { 7048 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 7049 } 7050 y = 4294967296 7051 r = x << y 7052 if r != 0 { 7053 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 7054 } 7055 y = 18446744073709551615 7056 r = x << y 7057 if r != 0 { 7058 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 7059 } 7060 x = 1 7061 y = 0 7062 r = x << y 7063 if r != 1 { 7064 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 7065 } 7066 y = 1 7067 r = x << y 7068 if r != 2 { 7069 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 7070 } 7071 y = 4294967296 7072 r = x << y 7073 if r != 0 { 7074 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 7075 } 7076 y = 18446744073709551615 7077 r = x << y 7078 if r != 0 { 7079 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 7080 } 7081 x = 4294967296 7082 y = 0 7083 r = x << y 7084 if r != 4294967296 { 7085 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 7086 } 7087 y = 1 7088 r = x << y 7089 if r != 8589934592 { 7090 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 7091 } 7092 y = 4294967296 7093 r = x << y 7094 if r != 0 { 7095 t.Errorf("4294967296 %s 4294967296 = %d, want 0", "<<", r) 7096 } 7097 y = 18446744073709551615 7098 r = x << y 7099 if r != 0 { 7100 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", "<<", r) 7101 } 7102 x = 9223372036854775806 7103 y = 0 7104 r = x << y 7105 if r != 9223372036854775806 { 7106 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "<<", r) 7107 } 7108 y = 1 7109 r = x << y 7110 if r != -4 { 7111 t.Errorf("9223372036854775806 %s 1 = %d, want -4", "<<", r) 7112 } 7113 y = 4294967296 7114 r = x << y 7115 if r != 0 { 7116 t.Errorf("9223372036854775806 %s 4294967296 = %d, want 0", "<<", r) 7117 } 7118 y = 18446744073709551615 7119 r = x << y 7120 if r != 0 { 7121 t.Errorf("9223372036854775806 %s 18446744073709551615 = %d, want 0", "<<", r) 7122 } 7123 x = 9223372036854775807 7124 y = 0 7125 r = x << y 7126 if r != 9223372036854775807 { 7127 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "<<", r) 7128 } 7129 y = 1 7130 r = x << y 7131 if r != -2 { 7132 t.Errorf("9223372036854775807 %s 1 = %d, want -2", "<<", r) 7133 } 7134 y = 4294967296 7135 r = x << y 7136 if r != 0 { 7137 t.Errorf("9223372036854775807 %s 4294967296 = %d, want 0", "<<", r) 7138 } 7139 y = 18446744073709551615 7140 r = x << y 7141 if r != 0 { 7142 t.Errorf("9223372036854775807 %s 18446744073709551615 = %d, want 0", "<<", r) 7143 } 7144 } 7145 func TestConstFoldint64uint64rsh(t *testing.T) { 7146 var x, r int64 7147 var y uint64 7148 x = -9223372036854775808 7149 y = 0 7150 r = x >> y 7151 if r != -9223372036854775808 { 7152 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", ">>", r) 7153 } 7154 y = 1 7155 r = x >> y 7156 if r != -4611686018427387904 { 7157 t.Errorf("-9223372036854775808 %s 1 = %d, want -4611686018427387904", ">>", r) 7158 } 7159 y = 4294967296 7160 r = x >> y 7161 if r != -1 { 7162 t.Errorf("-9223372036854775808 %s 4294967296 = %d, want -1", ">>", r) 7163 } 7164 y = 18446744073709551615 7165 r = x >> y 7166 if r != -1 { 7167 t.Errorf("-9223372036854775808 %s 18446744073709551615 = %d, want -1", ">>", r) 7168 } 7169 x = -9223372036854775807 7170 y = 0 7171 r = x >> y 7172 if r != -9223372036854775807 { 7173 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", ">>", r) 7174 } 7175 y = 1 7176 r = x >> y 7177 if r != -4611686018427387904 { 7178 t.Errorf("-9223372036854775807 %s 1 = %d, want -4611686018427387904", ">>", r) 7179 } 7180 y = 4294967296 7181 r = x >> y 7182 if r != -1 { 7183 t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -1", ">>", r) 7184 } 7185 y = 18446744073709551615 7186 r = x >> y 7187 if r != -1 { 7188 t.Errorf("-9223372036854775807 %s 18446744073709551615 = %d, want -1", ">>", r) 7189 } 7190 x = -4294967296 7191 y = 0 7192 r = x >> y 7193 if r != -4294967296 { 7194 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", ">>", r) 7195 } 7196 y = 1 7197 r = x >> y 7198 if r != -2147483648 { 7199 t.Errorf("-4294967296 %s 1 = %d, want -2147483648", ">>", r) 7200 } 7201 y = 4294967296 7202 r = x >> y 7203 if r != -1 { 7204 t.Errorf("-4294967296 %s 4294967296 = %d, want -1", ">>", r) 7205 } 7206 y = 18446744073709551615 7207 r = x >> y 7208 if r != -1 { 7209 t.Errorf("-4294967296 %s 18446744073709551615 = %d, want -1", ">>", r) 7210 } 7211 x = -1 7212 y = 0 7213 r = x >> y 7214 if r != -1 { 7215 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 7216 } 7217 y = 1 7218 r = x >> y 7219 if r != -1 { 7220 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 7221 } 7222 y = 4294967296 7223 r = x >> y 7224 if r != -1 { 7225 t.Errorf("-1 %s 4294967296 = %d, want -1", ">>", r) 7226 } 7227 y = 18446744073709551615 7228 r = x >> y 7229 if r != -1 { 7230 t.Errorf("-1 %s 18446744073709551615 = %d, want -1", ">>", r) 7231 } 7232 x = 0 7233 y = 0 7234 r = x >> y 7235 if r != 0 { 7236 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 7237 } 7238 y = 1 7239 r = x >> y 7240 if r != 0 { 7241 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 7242 } 7243 y = 4294967296 7244 r = x >> y 7245 if r != 0 { 7246 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 7247 } 7248 y = 18446744073709551615 7249 r = x >> y 7250 if r != 0 { 7251 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 7252 } 7253 x = 1 7254 y = 0 7255 r = x >> y 7256 if r != 1 { 7257 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 7258 } 7259 y = 1 7260 r = x >> y 7261 if r != 0 { 7262 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 7263 } 7264 y = 4294967296 7265 r = x >> y 7266 if r != 0 { 7267 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 7268 } 7269 y = 18446744073709551615 7270 r = x >> y 7271 if r != 0 { 7272 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 7273 } 7274 x = 4294967296 7275 y = 0 7276 r = x >> y 7277 if r != 4294967296 { 7278 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 7279 } 7280 y = 1 7281 r = x >> y 7282 if r != 2147483648 { 7283 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 7284 } 7285 y = 4294967296 7286 r = x >> y 7287 if r != 0 { 7288 t.Errorf("4294967296 %s 4294967296 = %d, want 0", ">>", r) 7289 } 7290 y = 18446744073709551615 7291 r = x >> y 7292 if r != 0 { 7293 t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", ">>", r) 7294 } 7295 x = 9223372036854775806 7296 y = 0 7297 r = x >> y 7298 if r != 9223372036854775806 { 7299 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", ">>", r) 7300 } 7301 y = 1 7302 r = x >> y 7303 if r != 4611686018427387903 { 7304 t.Errorf("9223372036854775806 %s 1 = %d, want 4611686018427387903", ">>", r) 7305 } 7306 y = 4294967296 7307 r = x >> y 7308 if r != 0 { 7309 t.Errorf("9223372036854775806 %s 4294967296 = %d, want 0", ">>", r) 7310 } 7311 y = 18446744073709551615 7312 r = x >> y 7313 if r != 0 { 7314 t.Errorf("9223372036854775806 %s 18446744073709551615 = %d, want 0", ">>", r) 7315 } 7316 x = 9223372036854775807 7317 y = 0 7318 r = x >> y 7319 if r != 9223372036854775807 { 7320 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", ">>", r) 7321 } 7322 y = 1 7323 r = x >> y 7324 if r != 4611686018427387903 { 7325 t.Errorf("9223372036854775807 %s 1 = %d, want 4611686018427387903", ">>", r) 7326 } 7327 y = 4294967296 7328 r = x >> y 7329 if r != 0 { 7330 t.Errorf("9223372036854775807 %s 4294967296 = %d, want 0", ">>", r) 7331 } 7332 y = 18446744073709551615 7333 r = x >> y 7334 if r != 0 { 7335 t.Errorf("9223372036854775807 %s 18446744073709551615 = %d, want 0", ">>", r) 7336 } 7337 } 7338 func TestConstFoldint64uint32lsh(t *testing.T) { 7339 var x, r int64 7340 var y uint32 7341 x = -9223372036854775808 7342 y = 0 7343 r = x << y 7344 if r != -9223372036854775808 { 7345 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "<<", r) 7346 } 7347 y = 1 7348 r = x << y 7349 if r != 0 { 7350 t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "<<", r) 7351 } 7352 y = 4294967295 7353 r = x << y 7354 if r != 0 { 7355 t.Errorf("-9223372036854775808 %s 4294967295 = %d, want 0", "<<", r) 7356 } 7357 x = -9223372036854775807 7358 y = 0 7359 r = x << y 7360 if r != -9223372036854775807 { 7361 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "<<", r) 7362 } 7363 y = 1 7364 r = x << y 7365 if r != 2 { 7366 t.Errorf("-9223372036854775807 %s 1 = %d, want 2", "<<", r) 7367 } 7368 y = 4294967295 7369 r = x << y 7370 if r != 0 { 7371 t.Errorf("-9223372036854775807 %s 4294967295 = %d, want 0", "<<", r) 7372 } 7373 x = -4294967296 7374 y = 0 7375 r = x << y 7376 if r != -4294967296 { 7377 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "<<", r) 7378 } 7379 y = 1 7380 r = x << y 7381 if r != -8589934592 { 7382 t.Errorf("-4294967296 %s 1 = %d, want -8589934592", "<<", r) 7383 } 7384 y = 4294967295 7385 r = x << y 7386 if r != 0 { 7387 t.Errorf("-4294967296 %s 4294967295 = %d, want 0", "<<", r) 7388 } 7389 x = -1 7390 y = 0 7391 r = x << y 7392 if r != -1 { 7393 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 7394 } 7395 y = 1 7396 r = x << y 7397 if r != -2 { 7398 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 7399 } 7400 y = 4294967295 7401 r = x << y 7402 if r != 0 { 7403 t.Errorf("-1 %s 4294967295 = %d, want 0", "<<", r) 7404 } 7405 x = 0 7406 y = 0 7407 r = x << y 7408 if r != 0 { 7409 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 7410 } 7411 y = 1 7412 r = x << y 7413 if r != 0 { 7414 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 7415 } 7416 y = 4294967295 7417 r = x << y 7418 if r != 0 { 7419 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 7420 } 7421 x = 1 7422 y = 0 7423 r = x << y 7424 if r != 1 { 7425 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 7426 } 7427 y = 1 7428 r = x << y 7429 if r != 2 { 7430 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 7431 } 7432 y = 4294967295 7433 r = x << y 7434 if r != 0 { 7435 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 7436 } 7437 x = 4294967296 7438 y = 0 7439 r = x << y 7440 if r != 4294967296 { 7441 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 7442 } 7443 y = 1 7444 r = x << y 7445 if r != 8589934592 { 7446 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 7447 } 7448 y = 4294967295 7449 r = x << y 7450 if r != 0 { 7451 t.Errorf("4294967296 %s 4294967295 = %d, want 0", "<<", r) 7452 } 7453 x = 9223372036854775806 7454 y = 0 7455 r = x << y 7456 if r != 9223372036854775806 { 7457 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "<<", r) 7458 } 7459 y = 1 7460 r = x << y 7461 if r != -4 { 7462 t.Errorf("9223372036854775806 %s 1 = %d, want -4", "<<", r) 7463 } 7464 y = 4294967295 7465 r = x << y 7466 if r != 0 { 7467 t.Errorf("9223372036854775806 %s 4294967295 = %d, want 0", "<<", r) 7468 } 7469 x = 9223372036854775807 7470 y = 0 7471 r = x << y 7472 if r != 9223372036854775807 { 7473 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "<<", r) 7474 } 7475 y = 1 7476 r = x << y 7477 if r != -2 { 7478 t.Errorf("9223372036854775807 %s 1 = %d, want -2", "<<", r) 7479 } 7480 y = 4294967295 7481 r = x << y 7482 if r != 0 { 7483 t.Errorf("9223372036854775807 %s 4294967295 = %d, want 0", "<<", r) 7484 } 7485 } 7486 func TestConstFoldint64uint32rsh(t *testing.T) { 7487 var x, r int64 7488 var y uint32 7489 x = -9223372036854775808 7490 y = 0 7491 r = x >> y 7492 if r != -9223372036854775808 { 7493 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", ">>", r) 7494 } 7495 y = 1 7496 r = x >> y 7497 if r != -4611686018427387904 { 7498 t.Errorf("-9223372036854775808 %s 1 = %d, want -4611686018427387904", ">>", r) 7499 } 7500 y = 4294967295 7501 r = x >> y 7502 if r != -1 { 7503 t.Errorf("-9223372036854775808 %s 4294967295 = %d, want -1", ">>", r) 7504 } 7505 x = -9223372036854775807 7506 y = 0 7507 r = x >> y 7508 if r != -9223372036854775807 { 7509 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", ">>", r) 7510 } 7511 y = 1 7512 r = x >> y 7513 if r != -4611686018427387904 { 7514 t.Errorf("-9223372036854775807 %s 1 = %d, want -4611686018427387904", ">>", r) 7515 } 7516 y = 4294967295 7517 r = x >> y 7518 if r != -1 { 7519 t.Errorf("-9223372036854775807 %s 4294967295 = %d, want -1", ">>", r) 7520 } 7521 x = -4294967296 7522 y = 0 7523 r = x >> y 7524 if r != -4294967296 { 7525 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", ">>", r) 7526 } 7527 y = 1 7528 r = x >> y 7529 if r != -2147483648 { 7530 t.Errorf("-4294967296 %s 1 = %d, want -2147483648", ">>", r) 7531 } 7532 y = 4294967295 7533 r = x >> y 7534 if r != -1 { 7535 t.Errorf("-4294967296 %s 4294967295 = %d, want -1", ">>", r) 7536 } 7537 x = -1 7538 y = 0 7539 r = x >> y 7540 if r != -1 { 7541 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 7542 } 7543 y = 1 7544 r = x >> y 7545 if r != -1 { 7546 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 7547 } 7548 y = 4294967295 7549 r = x >> y 7550 if r != -1 { 7551 t.Errorf("-1 %s 4294967295 = %d, want -1", ">>", r) 7552 } 7553 x = 0 7554 y = 0 7555 r = x >> y 7556 if r != 0 { 7557 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 7558 } 7559 y = 1 7560 r = x >> y 7561 if r != 0 { 7562 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 7563 } 7564 y = 4294967295 7565 r = x >> y 7566 if r != 0 { 7567 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 7568 } 7569 x = 1 7570 y = 0 7571 r = x >> y 7572 if r != 1 { 7573 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 7574 } 7575 y = 1 7576 r = x >> y 7577 if r != 0 { 7578 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 7579 } 7580 y = 4294967295 7581 r = x >> y 7582 if r != 0 { 7583 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 7584 } 7585 x = 4294967296 7586 y = 0 7587 r = x >> y 7588 if r != 4294967296 { 7589 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 7590 } 7591 y = 1 7592 r = x >> y 7593 if r != 2147483648 { 7594 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 7595 } 7596 y = 4294967295 7597 r = x >> y 7598 if r != 0 { 7599 t.Errorf("4294967296 %s 4294967295 = %d, want 0", ">>", r) 7600 } 7601 x = 9223372036854775806 7602 y = 0 7603 r = x >> y 7604 if r != 9223372036854775806 { 7605 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", ">>", r) 7606 } 7607 y = 1 7608 r = x >> y 7609 if r != 4611686018427387903 { 7610 t.Errorf("9223372036854775806 %s 1 = %d, want 4611686018427387903", ">>", r) 7611 } 7612 y = 4294967295 7613 r = x >> y 7614 if r != 0 { 7615 t.Errorf("9223372036854775806 %s 4294967295 = %d, want 0", ">>", r) 7616 } 7617 x = 9223372036854775807 7618 y = 0 7619 r = x >> y 7620 if r != 9223372036854775807 { 7621 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", ">>", r) 7622 } 7623 y = 1 7624 r = x >> y 7625 if r != 4611686018427387903 { 7626 t.Errorf("9223372036854775807 %s 1 = %d, want 4611686018427387903", ">>", r) 7627 } 7628 y = 4294967295 7629 r = x >> y 7630 if r != 0 { 7631 t.Errorf("9223372036854775807 %s 4294967295 = %d, want 0", ">>", r) 7632 } 7633 } 7634 func TestConstFoldint64uint16lsh(t *testing.T) { 7635 var x, r int64 7636 var y uint16 7637 x = -9223372036854775808 7638 y = 0 7639 r = x << y 7640 if r != -9223372036854775808 { 7641 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "<<", r) 7642 } 7643 y = 1 7644 r = x << y 7645 if r != 0 { 7646 t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "<<", r) 7647 } 7648 y = 65535 7649 r = x << y 7650 if r != 0 { 7651 t.Errorf("-9223372036854775808 %s 65535 = %d, want 0", "<<", r) 7652 } 7653 x = -9223372036854775807 7654 y = 0 7655 r = x << y 7656 if r != -9223372036854775807 { 7657 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "<<", r) 7658 } 7659 y = 1 7660 r = x << y 7661 if r != 2 { 7662 t.Errorf("-9223372036854775807 %s 1 = %d, want 2", "<<", r) 7663 } 7664 y = 65535 7665 r = x << y 7666 if r != 0 { 7667 t.Errorf("-9223372036854775807 %s 65535 = %d, want 0", "<<", r) 7668 } 7669 x = -4294967296 7670 y = 0 7671 r = x << y 7672 if r != -4294967296 { 7673 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "<<", r) 7674 } 7675 y = 1 7676 r = x << y 7677 if r != -8589934592 { 7678 t.Errorf("-4294967296 %s 1 = %d, want -8589934592", "<<", r) 7679 } 7680 y = 65535 7681 r = x << y 7682 if r != 0 { 7683 t.Errorf("-4294967296 %s 65535 = %d, want 0", "<<", r) 7684 } 7685 x = -1 7686 y = 0 7687 r = x << y 7688 if r != -1 { 7689 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 7690 } 7691 y = 1 7692 r = x << y 7693 if r != -2 { 7694 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 7695 } 7696 y = 65535 7697 r = x << y 7698 if r != 0 { 7699 t.Errorf("-1 %s 65535 = %d, want 0", "<<", r) 7700 } 7701 x = 0 7702 y = 0 7703 r = x << y 7704 if r != 0 { 7705 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 7706 } 7707 y = 1 7708 r = x << y 7709 if r != 0 { 7710 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 7711 } 7712 y = 65535 7713 r = x << y 7714 if r != 0 { 7715 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 7716 } 7717 x = 1 7718 y = 0 7719 r = x << y 7720 if r != 1 { 7721 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 7722 } 7723 y = 1 7724 r = x << y 7725 if r != 2 { 7726 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 7727 } 7728 y = 65535 7729 r = x << y 7730 if r != 0 { 7731 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 7732 } 7733 x = 4294967296 7734 y = 0 7735 r = x << y 7736 if r != 4294967296 { 7737 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 7738 } 7739 y = 1 7740 r = x << y 7741 if r != 8589934592 { 7742 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 7743 } 7744 y = 65535 7745 r = x << y 7746 if r != 0 { 7747 t.Errorf("4294967296 %s 65535 = %d, want 0", "<<", r) 7748 } 7749 x = 9223372036854775806 7750 y = 0 7751 r = x << y 7752 if r != 9223372036854775806 { 7753 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "<<", r) 7754 } 7755 y = 1 7756 r = x << y 7757 if r != -4 { 7758 t.Errorf("9223372036854775806 %s 1 = %d, want -4", "<<", r) 7759 } 7760 y = 65535 7761 r = x << y 7762 if r != 0 { 7763 t.Errorf("9223372036854775806 %s 65535 = %d, want 0", "<<", r) 7764 } 7765 x = 9223372036854775807 7766 y = 0 7767 r = x << y 7768 if r != 9223372036854775807 { 7769 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "<<", r) 7770 } 7771 y = 1 7772 r = x << y 7773 if r != -2 { 7774 t.Errorf("9223372036854775807 %s 1 = %d, want -2", "<<", r) 7775 } 7776 y = 65535 7777 r = x << y 7778 if r != 0 { 7779 t.Errorf("9223372036854775807 %s 65535 = %d, want 0", "<<", r) 7780 } 7781 } 7782 func TestConstFoldint64uint16rsh(t *testing.T) { 7783 var x, r int64 7784 var y uint16 7785 x = -9223372036854775808 7786 y = 0 7787 r = x >> y 7788 if r != -9223372036854775808 { 7789 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", ">>", r) 7790 } 7791 y = 1 7792 r = x >> y 7793 if r != -4611686018427387904 { 7794 t.Errorf("-9223372036854775808 %s 1 = %d, want -4611686018427387904", ">>", r) 7795 } 7796 y = 65535 7797 r = x >> y 7798 if r != -1 { 7799 t.Errorf("-9223372036854775808 %s 65535 = %d, want -1", ">>", r) 7800 } 7801 x = -9223372036854775807 7802 y = 0 7803 r = x >> y 7804 if r != -9223372036854775807 { 7805 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", ">>", r) 7806 } 7807 y = 1 7808 r = x >> y 7809 if r != -4611686018427387904 { 7810 t.Errorf("-9223372036854775807 %s 1 = %d, want -4611686018427387904", ">>", r) 7811 } 7812 y = 65535 7813 r = x >> y 7814 if r != -1 { 7815 t.Errorf("-9223372036854775807 %s 65535 = %d, want -1", ">>", r) 7816 } 7817 x = -4294967296 7818 y = 0 7819 r = x >> y 7820 if r != -4294967296 { 7821 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", ">>", r) 7822 } 7823 y = 1 7824 r = x >> y 7825 if r != -2147483648 { 7826 t.Errorf("-4294967296 %s 1 = %d, want -2147483648", ">>", r) 7827 } 7828 y = 65535 7829 r = x >> y 7830 if r != -1 { 7831 t.Errorf("-4294967296 %s 65535 = %d, want -1", ">>", r) 7832 } 7833 x = -1 7834 y = 0 7835 r = x >> y 7836 if r != -1 { 7837 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 7838 } 7839 y = 1 7840 r = x >> y 7841 if r != -1 { 7842 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 7843 } 7844 y = 65535 7845 r = x >> y 7846 if r != -1 { 7847 t.Errorf("-1 %s 65535 = %d, want -1", ">>", r) 7848 } 7849 x = 0 7850 y = 0 7851 r = x >> y 7852 if r != 0 { 7853 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 7854 } 7855 y = 1 7856 r = x >> y 7857 if r != 0 { 7858 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 7859 } 7860 y = 65535 7861 r = x >> y 7862 if r != 0 { 7863 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 7864 } 7865 x = 1 7866 y = 0 7867 r = x >> y 7868 if r != 1 { 7869 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 7870 } 7871 y = 1 7872 r = x >> y 7873 if r != 0 { 7874 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 7875 } 7876 y = 65535 7877 r = x >> y 7878 if r != 0 { 7879 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 7880 } 7881 x = 4294967296 7882 y = 0 7883 r = x >> y 7884 if r != 4294967296 { 7885 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 7886 } 7887 y = 1 7888 r = x >> y 7889 if r != 2147483648 { 7890 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 7891 } 7892 y = 65535 7893 r = x >> y 7894 if r != 0 { 7895 t.Errorf("4294967296 %s 65535 = %d, want 0", ">>", r) 7896 } 7897 x = 9223372036854775806 7898 y = 0 7899 r = x >> y 7900 if r != 9223372036854775806 { 7901 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", ">>", r) 7902 } 7903 y = 1 7904 r = x >> y 7905 if r != 4611686018427387903 { 7906 t.Errorf("9223372036854775806 %s 1 = %d, want 4611686018427387903", ">>", r) 7907 } 7908 y = 65535 7909 r = x >> y 7910 if r != 0 { 7911 t.Errorf("9223372036854775806 %s 65535 = %d, want 0", ">>", r) 7912 } 7913 x = 9223372036854775807 7914 y = 0 7915 r = x >> y 7916 if r != 9223372036854775807 { 7917 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", ">>", r) 7918 } 7919 y = 1 7920 r = x >> y 7921 if r != 4611686018427387903 { 7922 t.Errorf("9223372036854775807 %s 1 = %d, want 4611686018427387903", ">>", r) 7923 } 7924 y = 65535 7925 r = x >> y 7926 if r != 0 { 7927 t.Errorf("9223372036854775807 %s 65535 = %d, want 0", ">>", r) 7928 } 7929 } 7930 func TestConstFoldint64uint8lsh(t *testing.T) { 7931 var x, r int64 7932 var y uint8 7933 x = -9223372036854775808 7934 y = 0 7935 r = x << y 7936 if r != -9223372036854775808 { 7937 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "<<", r) 7938 } 7939 y = 1 7940 r = x << y 7941 if r != 0 { 7942 t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "<<", r) 7943 } 7944 y = 255 7945 r = x << y 7946 if r != 0 { 7947 t.Errorf("-9223372036854775808 %s 255 = %d, want 0", "<<", r) 7948 } 7949 x = -9223372036854775807 7950 y = 0 7951 r = x << y 7952 if r != -9223372036854775807 { 7953 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "<<", r) 7954 } 7955 y = 1 7956 r = x << y 7957 if r != 2 { 7958 t.Errorf("-9223372036854775807 %s 1 = %d, want 2", "<<", r) 7959 } 7960 y = 255 7961 r = x << y 7962 if r != 0 { 7963 t.Errorf("-9223372036854775807 %s 255 = %d, want 0", "<<", r) 7964 } 7965 x = -4294967296 7966 y = 0 7967 r = x << y 7968 if r != -4294967296 { 7969 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "<<", r) 7970 } 7971 y = 1 7972 r = x << y 7973 if r != -8589934592 { 7974 t.Errorf("-4294967296 %s 1 = %d, want -8589934592", "<<", r) 7975 } 7976 y = 255 7977 r = x << y 7978 if r != 0 { 7979 t.Errorf("-4294967296 %s 255 = %d, want 0", "<<", r) 7980 } 7981 x = -1 7982 y = 0 7983 r = x << y 7984 if r != -1 { 7985 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 7986 } 7987 y = 1 7988 r = x << y 7989 if r != -2 { 7990 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 7991 } 7992 y = 255 7993 r = x << y 7994 if r != 0 { 7995 t.Errorf("-1 %s 255 = %d, want 0", "<<", r) 7996 } 7997 x = 0 7998 y = 0 7999 r = x << y 8000 if r != 0 { 8001 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8002 } 8003 y = 1 8004 r = x << y 8005 if r != 0 { 8006 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8007 } 8008 y = 255 8009 r = x << y 8010 if r != 0 { 8011 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 8012 } 8013 x = 1 8014 y = 0 8015 r = x << y 8016 if r != 1 { 8017 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8018 } 8019 y = 1 8020 r = x << y 8021 if r != 2 { 8022 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8023 } 8024 y = 255 8025 r = x << y 8026 if r != 0 { 8027 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 8028 } 8029 x = 4294967296 8030 y = 0 8031 r = x << y 8032 if r != 4294967296 { 8033 t.Errorf("4294967296 %s 0 = %d, want 4294967296", "<<", r) 8034 } 8035 y = 1 8036 r = x << y 8037 if r != 8589934592 { 8038 t.Errorf("4294967296 %s 1 = %d, want 8589934592", "<<", r) 8039 } 8040 y = 255 8041 r = x << y 8042 if r != 0 { 8043 t.Errorf("4294967296 %s 255 = %d, want 0", "<<", r) 8044 } 8045 x = 9223372036854775806 8046 y = 0 8047 r = x << y 8048 if r != 9223372036854775806 { 8049 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "<<", r) 8050 } 8051 y = 1 8052 r = x << y 8053 if r != -4 { 8054 t.Errorf("9223372036854775806 %s 1 = %d, want -4", "<<", r) 8055 } 8056 y = 255 8057 r = x << y 8058 if r != 0 { 8059 t.Errorf("9223372036854775806 %s 255 = %d, want 0", "<<", r) 8060 } 8061 x = 9223372036854775807 8062 y = 0 8063 r = x << y 8064 if r != 9223372036854775807 { 8065 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "<<", r) 8066 } 8067 y = 1 8068 r = x << y 8069 if r != -2 { 8070 t.Errorf("9223372036854775807 %s 1 = %d, want -2", "<<", r) 8071 } 8072 y = 255 8073 r = x << y 8074 if r != 0 { 8075 t.Errorf("9223372036854775807 %s 255 = %d, want 0", "<<", r) 8076 } 8077 } 8078 func TestConstFoldint64uint8rsh(t *testing.T) { 8079 var x, r int64 8080 var y uint8 8081 x = -9223372036854775808 8082 y = 0 8083 r = x >> y 8084 if r != -9223372036854775808 { 8085 t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", ">>", r) 8086 } 8087 y = 1 8088 r = x >> y 8089 if r != -4611686018427387904 { 8090 t.Errorf("-9223372036854775808 %s 1 = %d, want -4611686018427387904", ">>", r) 8091 } 8092 y = 255 8093 r = x >> y 8094 if r != -1 { 8095 t.Errorf("-9223372036854775808 %s 255 = %d, want -1", ">>", r) 8096 } 8097 x = -9223372036854775807 8098 y = 0 8099 r = x >> y 8100 if r != -9223372036854775807 { 8101 t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", ">>", r) 8102 } 8103 y = 1 8104 r = x >> y 8105 if r != -4611686018427387904 { 8106 t.Errorf("-9223372036854775807 %s 1 = %d, want -4611686018427387904", ">>", r) 8107 } 8108 y = 255 8109 r = x >> y 8110 if r != -1 { 8111 t.Errorf("-9223372036854775807 %s 255 = %d, want -1", ">>", r) 8112 } 8113 x = -4294967296 8114 y = 0 8115 r = x >> y 8116 if r != -4294967296 { 8117 t.Errorf("-4294967296 %s 0 = %d, want -4294967296", ">>", r) 8118 } 8119 y = 1 8120 r = x >> y 8121 if r != -2147483648 { 8122 t.Errorf("-4294967296 %s 1 = %d, want -2147483648", ">>", r) 8123 } 8124 y = 255 8125 r = x >> y 8126 if r != -1 { 8127 t.Errorf("-4294967296 %s 255 = %d, want -1", ">>", r) 8128 } 8129 x = -1 8130 y = 0 8131 r = x >> y 8132 if r != -1 { 8133 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 8134 } 8135 y = 1 8136 r = x >> y 8137 if r != -1 { 8138 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 8139 } 8140 y = 255 8141 r = x >> y 8142 if r != -1 { 8143 t.Errorf("-1 %s 255 = %d, want -1", ">>", r) 8144 } 8145 x = 0 8146 y = 0 8147 r = x >> y 8148 if r != 0 { 8149 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8150 } 8151 y = 1 8152 r = x >> y 8153 if r != 0 { 8154 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8155 } 8156 y = 255 8157 r = x >> y 8158 if r != 0 { 8159 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 8160 } 8161 x = 1 8162 y = 0 8163 r = x >> y 8164 if r != 1 { 8165 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8166 } 8167 y = 1 8168 r = x >> y 8169 if r != 0 { 8170 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8171 } 8172 y = 255 8173 r = x >> y 8174 if r != 0 { 8175 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 8176 } 8177 x = 4294967296 8178 y = 0 8179 r = x >> y 8180 if r != 4294967296 { 8181 t.Errorf("4294967296 %s 0 = %d, want 4294967296", ">>", r) 8182 } 8183 y = 1 8184 r = x >> y 8185 if r != 2147483648 { 8186 t.Errorf("4294967296 %s 1 = %d, want 2147483648", ">>", r) 8187 } 8188 y = 255 8189 r = x >> y 8190 if r != 0 { 8191 t.Errorf("4294967296 %s 255 = %d, want 0", ">>", r) 8192 } 8193 x = 9223372036854775806 8194 y = 0 8195 r = x >> y 8196 if r != 9223372036854775806 { 8197 t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", ">>", r) 8198 } 8199 y = 1 8200 r = x >> y 8201 if r != 4611686018427387903 { 8202 t.Errorf("9223372036854775806 %s 1 = %d, want 4611686018427387903", ">>", r) 8203 } 8204 y = 255 8205 r = x >> y 8206 if r != 0 { 8207 t.Errorf("9223372036854775806 %s 255 = %d, want 0", ">>", r) 8208 } 8209 x = 9223372036854775807 8210 y = 0 8211 r = x >> y 8212 if r != 9223372036854775807 { 8213 t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", ">>", r) 8214 } 8215 y = 1 8216 r = x >> y 8217 if r != 4611686018427387903 { 8218 t.Errorf("9223372036854775807 %s 1 = %d, want 4611686018427387903", ">>", r) 8219 } 8220 y = 255 8221 r = x >> y 8222 if r != 0 { 8223 t.Errorf("9223372036854775807 %s 255 = %d, want 0", ">>", r) 8224 } 8225 } 8226 func TestConstFolduint32uint64lsh(t *testing.T) { 8227 var x, r uint32 8228 var y uint64 8229 x = 0 8230 y = 0 8231 r = x << y 8232 if r != 0 { 8233 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8234 } 8235 y = 1 8236 r = x << y 8237 if r != 0 { 8238 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8239 } 8240 y = 4294967296 8241 r = x << y 8242 if r != 0 { 8243 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 8244 } 8245 y = 18446744073709551615 8246 r = x << y 8247 if r != 0 { 8248 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 8249 } 8250 x = 1 8251 y = 0 8252 r = x << y 8253 if r != 1 { 8254 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8255 } 8256 y = 1 8257 r = x << y 8258 if r != 2 { 8259 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8260 } 8261 y = 4294967296 8262 r = x << y 8263 if r != 0 { 8264 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 8265 } 8266 y = 18446744073709551615 8267 r = x << y 8268 if r != 0 { 8269 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 8270 } 8271 x = 4294967295 8272 y = 0 8273 r = x << y 8274 if r != 4294967295 { 8275 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "<<", r) 8276 } 8277 y = 1 8278 r = x << y 8279 if r != 4294967294 { 8280 t.Errorf("4294967295 %s 1 = %d, want 4294967294", "<<", r) 8281 } 8282 y = 4294967296 8283 r = x << y 8284 if r != 0 { 8285 t.Errorf("4294967295 %s 4294967296 = %d, want 0", "<<", r) 8286 } 8287 y = 18446744073709551615 8288 r = x << y 8289 if r != 0 { 8290 t.Errorf("4294967295 %s 18446744073709551615 = %d, want 0", "<<", r) 8291 } 8292 } 8293 func TestConstFolduint32uint64rsh(t *testing.T) { 8294 var x, r uint32 8295 var y uint64 8296 x = 0 8297 y = 0 8298 r = x >> y 8299 if r != 0 { 8300 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8301 } 8302 y = 1 8303 r = x >> y 8304 if r != 0 { 8305 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8306 } 8307 y = 4294967296 8308 r = x >> y 8309 if r != 0 { 8310 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 8311 } 8312 y = 18446744073709551615 8313 r = x >> y 8314 if r != 0 { 8315 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 8316 } 8317 x = 1 8318 y = 0 8319 r = x >> y 8320 if r != 1 { 8321 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8322 } 8323 y = 1 8324 r = x >> y 8325 if r != 0 { 8326 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8327 } 8328 y = 4294967296 8329 r = x >> y 8330 if r != 0 { 8331 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 8332 } 8333 y = 18446744073709551615 8334 r = x >> y 8335 if r != 0 { 8336 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 8337 } 8338 x = 4294967295 8339 y = 0 8340 r = x >> y 8341 if r != 4294967295 { 8342 t.Errorf("4294967295 %s 0 = %d, want 4294967295", ">>", r) 8343 } 8344 y = 1 8345 r = x >> y 8346 if r != 2147483647 { 8347 t.Errorf("4294967295 %s 1 = %d, want 2147483647", ">>", r) 8348 } 8349 y = 4294967296 8350 r = x >> y 8351 if r != 0 { 8352 t.Errorf("4294967295 %s 4294967296 = %d, want 0", ">>", r) 8353 } 8354 y = 18446744073709551615 8355 r = x >> y 8356 if r != 0 { 8357 t.Errorf("4294967295 %s 18446744073709551615 = %d, want 0", ">>", r) 8358 } 8359 } 8360 func TestConstFolduint32uint32lsh(t *testing.T) { 8361 var x, r uint32 8362 var y uint32 8363 x = 0 8364 y = 0 8365 r = x << y 8366 if r != 0 { 8367 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8368 } 8369 y = 1 8370 r = x << y 8371 if r != 0 { 8372 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8373 } 8374 y = 4294967295 8375 r = x << y 8376 if r != 0 { 8377 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 8378 } 8379 x = 1 8380 y = 0 8381 r = x << y 8382 if r != 1 { 8383 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8384 } 8385 y = 1 8386 r = x << y 8387 if r != 2 { 8388 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8389 } 8390 y = 4294967295 8391 r = x << y 8392 if r != 0 { 8393 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 8394 } 8395 x = 4294967295 8396 y = 0 8397 r = x << y 8398 if r != 4294967295 { 8399 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "<<", r) 8400 } 8401 y = 1 8402 r = x << y 8403 if r != 4294967294 { 8404 t.Errorf("4294967295 %s 1 = %d, want 4294967294", "<<", r) 8405 } 8406 y = 4294967295 8407 r = x << y 8408 if r != 0 { 8409 t.Errorf("4294967295 %s 4294967295 = %d, want 0", "<<", r) 8410 } 8411 } 8412 func TestConstFolduint32uint32rsh(t *testing.T) { 8413 var x, r uint32 8414 var y uint32 8415 x = 0 8416 y = 0 8417 r = x >> y 8418 if r != 0 { 8419 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8420 } 8421 y = 1 8422 r = x >> y 8423 if r != 0 { 8424 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8425 } 8426 y = 4294967295 8427 r = x >> y 8428 if r != 0 { 8429 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 8430 } 8431 x = 1 8432 y = 0 8433 r = x >> y 8434 if r != 1 { 8435 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8436 } 8437 y = 1 8438 r = x >> y 8439 if r != 0 { 8440 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8441 } 8442 y = 4294967295 8443 r = x >> y 8444 if r != 0 { 8445 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 8446 } 8447 x = 4294967295 8448 y = 0 8449 r = x >> y 8450 if r != 4294967295 { 8451 t.Errorf("4294967295 %s 0 = %d, want 4294967295", ">>", r) 8452 } 8453 y = 1 8454 r = x >> y 8455 if r != 2147483647 { 8456 t.Errorf("4294967295 %s 1 = %d, want 2147483647", ">>", r) 8457 } 8458 y = 4294967295 8459 r = x >> y 8460 if r != 0 { 8461 t.Errorf("4294967295 %s 4294967295 = %d, want 0", ">>", r) 8462 } 8463 } 8464 func TestConstFolduint32uint16lsh(t *testing.T) { 8465 var x, r uint32 8466 var y uint16 8467 x = 0 8468 y = 0 8469 r = x << y 8470 if r != 0 { 8471 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8472 } 8473 y = 1 8474 r = x << y 8475 if r != 0 { 8476 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8477 } 8478 y = 65535 8479 r = x << y 8480 if r != 0 { 8481 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 8482 } 8483 x = 1 8484 y = 0 8485 r = x << y 8486 if r != 1 { 8487 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8488 } 8489 y = 1 8490 r = x << y 8491 if r != 2 { 8492 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8493 } 8494 y = 65535 8495 r = x << y 8496 if r != 0 { 8497 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 8498 } 8499 x = 4294967295 8500 y = 0 8501 r = x << y 8502 if r != 4294967295 { 8503 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "<<", r) 8504 } 8505 y = 1 8506 r = x << y 8507 if r != 4294967294 { 8508 t.Errorf("4294967295 %s 1 = %d, want 4294967294", "<<", r) 8509 } 8510 y = 65535 8511 r = x << y 8512 if r != 0 { 8513 t.Errorf("4294967295 %s 65535 = %d, want 0", "<<", r) 8514 } 8515 } 8516 func TestConstFolduint32uint16rsh(t *testing.T) { 8517 var x, r uint32 8518 var y uint16 8519 x = 0 8520 y = 0 8521 r = x >> y 8522 if r != 0 { 8523 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8524 } 8525 y = 1 8526 r = x >> y 8527 if r != 0 { 8528 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8529 } 8530 y = 65535 8531 r = x >> y 8532 if r != 0 { 8533 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 8534 } 8535 x = 1 8536 y = 0 8537 r = x >> y 8538 if r != 1 { 8539 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8540 } 8541 y = 1 8542 r = x >> y 8543 if r != 0 { 8544 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8545 } 8546 y = 65535 8547 r = x >> y 8548 if r != 0 { 8549 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 8550 } 8551 x = 4294967295 8552 y = 0 8553 r = x >> y 8554 if r != 4294967295 { 8555 t.Errorf("4294967295 %s 0 = %d, want 4294967295", ">>", r) 8556 } 8557 y = 1 8558 r = x >> y 8559 if r != 2147483647 { 8560 t.Errorf("4294967295 %s 1 = %d, want 2147483647", ">>", r) 8561 } 8562 y = 65535 8563 r = x >> y 8564 if r != 0 { 8565 t.Errorf("4294967295 %s 65535 = %d, want 0", ">>", r) 8566 } 8567 } 8568 func TestConstFolduint32uint8lsh(t *testing.T) { 8569 var x, r uint32 8570 var y uint8 8571 x = 0 8572 y = 0 8573 r = x << y 8574 if r != 0 { 8575 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8576 } 8577 y = 1 8578 r = x << y 8579 if r != 0 { 8580 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8581 } 8582 y = 255 8583 r = x << y 8584 if r != 0 { 8585 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 8586 } 8587 x = 1 8588 y = 0 8589 r = x << y 8590 if r != 1 { 8591 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8592 } 8593 y = 1 8594 r = x << y 8595 if r != 2 { 8596 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8597 } 8598 y = 255 8599 r = x << y 8600 if r != 0 { 8601 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 8602 } 8603 x = 4294967295 8604 y = 0 8605 r = x << y 8606 if r != 4294967295 { 8607 t.Errorf("4294967295 %s 0 = %d, want 4294967295", "<<", r) 8608 } 8609 y = 1 8610 r = x << y 8611 if r != 4294967294 { 8612 t.Errorf("4294967295 %s 1 = %d, want 4294967294", "<<", r) 8613 } 8614 y = 255 8615 r = x << y 8616 if r != 0 { 8617 t.Errorf("4294967295 %s 255 = %d, want 0", "<<", r) 8618 } 8619 } 8620 func TestConstFolduint32uint8rsh(t *testing.T) { 8621 var x, r uint32 8622 var y uint8 8623 x = 0 8624 y = 0 8625 r = x >> y 8626 if r != 0 { 8627 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8628 } 8629 y = 1 8630 r = x >> y 8631 if r != 0 { 8632 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8633 } 8634 y = 255 8635 r = x >> y 8636 if r != 0 { 8637 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 8638 } 8639 x = 1 8640 y = 0 8641 r = x >> y 8642 if r != 1 { 8643 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8644 } 8645 y = 1 8646 r = x >> y 8647 if r != 0 { 8648 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8649 } 8650 y = 255 8651 r = x >> y 8652 if r != 0 { 8653 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 8654 } 8655 x = 4294967295 8656 y = 0 8657 r = x >> y 8658 if r != 4294967295 { 8659 t.Errorf("4294967295 %s 0 = %d, want 4294967295", ">>", r) 8660 } 8661 y = 1 8662 r = x >> y 8663 if r != 2147483647 { 8664 t.Errorf("4294967295 %s 1 = %d, want 2147483647", ">>", r) 8665 } 8666 y = 255 8667 r = x >> y 8668 if r != 0 { 8669 t.Errorf("4294967295 %s 255 = %d, want 0", ">>", r) 8670 } 8671 } 8672 func TestConstFoldint32uint64lsh(t *testing.T) { 8673 var x, r int32 8674 var y uint64 8675 x = -2147483648 8676 y = 0 8677 r = x << y 8678 if r != -2147483648 { 8679 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "<<", r) 8680 } 8681 y = 1 8682 r = x << y 8683 if r != 0 { 8684 t.Errorf("-2147483648 %s 1 = %d, want 0", "<<", r) 8685 } 8686 y = 4294967296 8687 r = x << y 8688 if r != 0 { 8689 t.Errorf("-2147483648 %s 4294967296 = %d, want 0", "<<", r) 8690 } 8691 y = 18446744073709551615 8692 r = x << y 8693 if r != 0 { 8694 t.Errorf("-2147483648 %s 18446744073709551615 = %d, want 0", "<<", r) 8695 } 8696 x = -2147483647 8697 y = 0 8698 r = x << y 8699 if r != -2147483647 { 8700 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "<<", r) 8701 } 8702 y = 1 8703 r = x << y 8704 if r != 2 { 8705 t.Errorf("-2147483647 %s 1 = %d, want 2", "<<", r) 8706 } 8707 y = 4294967296 8708 r = x << y 8709 if r != 0 { 8710 t.Errorf("-2147483647 %s 4294967296 = %d, want 0", "<<", r) 8711 } 8712 y = 18446744073709551615 8713 r = x << y 8714 if r != 0 { 8715 t.Errorf("-2147483647 %s 18446744073709551615 = %d, want 0", "<<", r) 8716 } 8717 x = -1 8718 y = 0 8719 r = x << y 8720 if r != -1 { 8721 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 8722 } 8723 y = 1 8724 r = x << y 8725 if r != -2 { 8726 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 8727 } 8728 y = 4294967296 8729 r = x << y 8730 if r != 0 { 8731 t.Errorf("-1 %s 4294967296 = %d, want 0", "<<", r) 8732 } 8733 y = 18446744073709551615 8734 r = x << y 8735 if r != 0 { 8736 t.Errorf("-1 %s 18446744073709551615 = %d, want 0", "<<", r) 8737 } 8738 x = 0 8739 y = 0 8740 r = x << y 8741 if r != 0 { 8742 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8743 } 8744 y = 1 8745 r = x << y 8746 if r != 0 { 8747 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8748 } 8749 y = 4294967296 8750 r = x << y 8751 if r != 0 { 8752 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 8753 } 8754 y = 18446744073709551615 8755 r = x << y 8756 if r != 0 { 8757 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 8758 } 8759 x = 1 8760 y = 0 8761 r = x << y 8762 if r != 1 { 8763 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 8764 } 8765 y = 1 8766 r = x << y 8767 if r != 2 { 8768 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 8769 } 8770 y = 4294967296 8771 r = x << y 8772 if r != 0 { 8773 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 8774 } 8775 y = 18446744073709551615 8776 r = x << y 8777 if r != 0 { 8778 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 8779 } 8780 x = 2147483647 8781 y = 0 8782 r = x << y 8783 if r != 2147483647 { 8784 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "<<", r) 8785 } 8786 y = 1 8787 r = x << y 8788 if r != -2 { 8789 t.Errorf("2147483647 %s 1 = %d, want -2", "<<", r) 8790 } 8791 y = 4294967296 8792 r = x << y 8793 if r != 0 { 8794 t.Errorf("2147483647 %s 4294967296 = %d, want 0", "<<", r) 8795 } 8796 y = 18446744073709551615 8797 r = x << y 8798 if r != 0 { 8799 t.Errorf("2147483647 %s 18446744073709551615 = %d, want 0", "<<", r) 8800 } 8801 } 8802 func TestConstFoldint32uint64rsh(t *testing.T) { 8803 var x, r int32 8804 var y uint64 8805 x = -2147483648 8806 y = 0 8807 r = x >> y 8808 if r != -2147483648 { 8809 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", ">>", r) 8810 } 8811 y = 1 8812 r = x >> y 8813 if r != -1073741824 { 8814 t.Errorf("-2147483648 %s 1 = %d, want -1073741824", ">>", r) 8815 } 8816 y = 4294967296 8817 r = x >> y 8818 if r != -1 { 8819 t.Errorf("-2147483648 %s 4294967296 = %d, want -1", ">>", r) 8820 } 8821 y = 18446744073709551615 8822 r = x >> y 8823 if r != -1 { 8824 t.Errorf("-2147483648 %s 18446744073709551615 = %d, want -1", ">>", r) 8825 } 8826 x = -2147483647 8827 y = 0 8828 r = x >> y 8829 if r != -2147483647 { 8830 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", ">>", r) 8831 } 8832 y = 1 8833 r = x >> y 8834 if r != -1073741824 { 8835 t.Errorf("-2147483647 %s 1 = %d, want -1073741824", ">>", r) 8836 } 8837 y = 4294967296 8838 r = x >> y 8839 if r != -1 { 8840 t.Errorf("-2147483647 %s 4294967296 = %d, want -1", ">>", r) 8841 } 8842 y = 18446744073709551615 8843 r = x >> y 8844 if r != -1 { 8845 t.Errorf("-2147483647 %s 18446744073709551615 = %d, want -1", ">>", r) 8846 } 8847 x = -1 8848 y = 0 8849 r = x >> y 8850 if r != -1 { 8851 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 8852 } 8853 y = 1 8854 r = x >> y 8855 if r != -1 { 8856 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 8857 } 8858 y = 4294967296 8859 r = x >> y 8860 if r != -1 { 8861 t.Errorf("-1 %s 4294967296 = %d, want -1", ">>", r) 8862 } 8863 y = 18446744073709551615 8864 r = x >> y 8865 if r != -1 { 8866 t.Errorf("-1 %s 18446744073709551615 = %d, want -1", ">>", r) 8867 } 8868 x = 0 8869 y = 0 8870 r = x >> y 8871 if r != 0 { 8872 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 8873 } 8874 y = 1 8875 r = x >> y 8876 if r != 0 { 8877 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 8878 } 8879 y = 4294967296 8880 r = x >> y 8881 if r != 0 { 8882 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 8883 } 8884 y = 18446744073709551615 8885 r = x >> y 8886 if r != 0 { 8887 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 8888 } 8889 x = 1 8890 y = 0 8891 r = x >> y 8892 if r != 1 { 8893 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 8894 } 8895 y = 1 8896 r = x >> y 8897 if r != 0 { 8898 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 8899 } 8900 y = 4294967296 8901 r = x >> y 8902 if r != 0 { 8903 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 8904 } 8905 y = 18446744073709551615 8906 r = x >> y 8907 if r != 0 { 8908 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 8909 } 8910 x = 2147483647 8911 y = 0 8912 r = x >> y 8913 if r != 2147483647 { 8914 t.Errorf("2147483647 %s 0 = %d, want 2147483647", ">>", r) 8915 } 8916 y = 1 8917 r = x >> y 8918 if r != 1073741823 { 8919 t.Errorf("2147483647 %s 1 = %d, want 1073741823", ">>", r) 8920 } 8921 y = 4294967296 8922 r = x >> y 8923 if r != 0 { 8924 t.Errorf("2147483647 %s 4294967296 = %d, want 0", ">>", r) 8925 } 8926 y = 18446744073709551615 8927 r = x >> y 8928 if r != 0 { 8929 t.Errorf("2147483647 %s 18446744073709551615 = %d, want 0", ">>", r) 8930 } 8931 } 8932 func TestConstFoldint32uint32lsh(t *testing.T) { 8933 var x, r int32 8934 var y uint32 8935 x = -2147483648 8936 y = 0 8937 r = x << y 8938 if r != -2147483648 { 8939 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "<<", r) 8940 } 8941 y = 1 8942 r = x << y 8943 if r != 0 { 8944 t.Errorf("-2147483648 %s 1 = %d, want 0", "<<", r) 8945 } 8946 y = 4294967295 8947 r = x << y 8948 if r != 0 { 8949 t.Errorf("-2147483648 %s 4294967295 = %d, want 0", "<<", r) 8950 } 8951 x = -2147483647 8952 y = 0 8953 r = x << y 8954 if r != -2147483647 { 8955 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "<<", r) 8956 } 8957 y = 1 8958 r = x << y 8959 if r != 2 { 8960 t.Errorf("-2147483647 %s 1 = %d, want 2", "<<", r) 8961 } 8962 y = 4294967295 8963 r = x << y 8964 if r != 0 { 8965 t.Errorf("-2147483647 %s 4294967295 = %d, want 0", "<<", r) 8966 } 8967 x = -1 8968 y = 0 8969 r = x << y 8970 if r != -1 { 8971 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 8972 } 8973 y = 1 8974 r = x << y 8975 if r != -2 { 8976 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 8977 } 8978 y = 4294967295 8979 r = x << y 8980 if r != 0 { 8981 t.Errorf("-1 %s 4294967295 = %d, want 0", "<<", r) 8982 } 8983 x = 0 8984 y = 0 8985 r = x << y 8986 if r != 0 { 8987 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 8988 } 8989 y = 1 8990 r = x << y 8991 if r != 0 { 8992 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 8993 } 8994 y = 4294967295 8995 r = x << y 8996 if r != 0 { 8997 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 8998 } 8999 x = 1 9000 y = 0 9001 r = x << y 9002 if r != 1 { 9003 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9004 } 9005 y = 1 9006 r = x << y 9007 if r != 2 { 9008 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9009 } 9010 y = 4294967295 9011 r = x << y 9012 if r != 0 { 9013 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 9014 } 9015 x = 2147483647 9016 y = 0 9017 r = x << y 9018 if r != 2147483647 { 9019 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "<<", r) 9020 } 9021 y = 1 9022 r = x << y 9023 if r != -2 { 9024 t.Errorf("2147483647 %s 1 = %d, want -2", "<<", r) 9025 } 9026 y = 4294967295 9027 r = x << y 9028 if r != 0 { 9029 t.Errorf("2147483647 %s 4294967295 = %d, want 0", "<<", r) 9030 } 9031 } 9032 func TestConstFoldint32uint32rsh(t *testing.T) { 9033 var x, r int32 9034 var y uint32 9035 x = -2147483648 9036 y = 0 9037 r = x >> y 9038 if r != -2147483648 { 9039 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", ">>", r) 9040 } 9041 y = 1 9042 r = x >> y 9043 if r != -1073741824 { 9044 t.Errorf("-2147483648 %s 1 = %d, want -1073741824", ">>", r) 9045 } 9046 y = 4294967295 9047 r = x >> y 9048 if r != -1 { 9049 t.Errorf("-2147483648 %s 4294967295 = %d, want -1", ">>", r) 9050 } 9051 x = -2147483647 9052 y = 0 9053 r = x >> y 9054 if r != -2147483647 { 9055 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", ">>", r) 9056 } 9057 y = 1 9058 r = x >> y 9059 if r != -1073741824 { 9060 t.Errorf("-2147483647 %s 1 = %d, want -1073741824", ">>", r) 9061 } 9062 y = 4294967295 9063 r = x >> y 9064 if r != -1 { 9065 t.Errorf("-2147483647 %s 4294967295 = %d, want -1", ">>", r) 9066 } 9067 x = -1 9068 y = 0 9069 r = x >> y 9070 if r != -1 { 9071 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 9072 } 9073 y = 1 9074 r = x >> y 9075 if r != -1 { 9076 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 9077 } 9078 y = 4294967295 9079 r = x >> y 9080 if r != -1 { 9081 t.Errorf("-1 %s 4294967295 = %d, want -1", ">>", r) 9082 } 9083 x = 0 9084 y = 0 9085 r = x >> y 9086 if r != 0 { 9087 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9088 } 9089 y = 1 9090 r = x >> y 9091 if r != 0 { 9092 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9093 } 9094 y = 4294967295 9095 r = x >> y 9096 if r != 0 { 9097 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 9098 } 9099 x = 1 9100 y = 0 9101 r = x >> y 9102 if r != 1 { 9103 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9104 } 9105 y = 1 9106 r = x >> y 9107 if r != 0 { 9108 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9109 } 9110 y = 4294967295 9111 r = x >> y 9112 if r != 0 { 9113 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 9114 } 9115 x = 2147483647 9116 y = 0 9117 r = x >> y 9118 if r != 2147483647 { 9119 t.Errorf("2147483647 %s 0 = %d, want 2147483647", ">>", r) 9120 } 9121 y = 1 9122 r = x >> y 9123 if r != 1073741823 { 9124 t.Errorf("2147483647 %s 1 = %d, want 1073741823", ">>", r) 9125 } 9126 y = 4294967295 9127 r = x >> y 9128 if r != 0 { 9129 t.Errorf("2147483647 %s 4294967295 = %d, want 0", ">>", r) 9130 } 9131 } 9132 func TestConstFoldint32uint16lsh(t *testing.T) { 9133 var x, r int32 9134 var y uint16 9135 x = -2147483648 9136 y = 0 9137 r = x << y 9138 if r != -2147483648 { 9139 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "<<", r) 9140 } 9141 y = 1 9142 r = x << y 9143 if r != 0 { 9144 t.Errorf("-2147483648 %s 1 = %d, want 0", "<<", r) 9145 } 9146 y = 65535 9147 r = x << y 9148 if r != 0 { 9149 t.Errorf("-2147483648 %s 65535 = %d, want 0", "<<", r) 9150 } 9151 x = -2147483647 9152 y = 0 9153 r = x << y 9154 if r != -2147483647 { 9155 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "<<", r) 9156 } 9157 y = 1 9158 r = x << y 9159 if r != 2 { 9160 t.Errorf("-2147483647 %s 1 = %d, want 2", "<<", r) 9161 } 9162 y = 65535 9163 r = x << y 9164 if r != 0 { 9165 t.Errorf("-2147483647 %s 65535 = %d, want 0", "<<", r) 9166 } 9167 x = -1 9168 y = 0 9169 r = x << y 9170 if r != -1 { 9171 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 9172 } 9173 y = 1 9174 r = x << y 9175 if r != -2 { 9176 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 9177 } 9178 y = 65535 9179 r = x << y 9180 if r != 0 { 9181 t.Errorf("-1 %s 65535 = %d, want 0", "<<", r) 9182 } 9183 x = 0 9184 y = 0 9185 r = x << y 9186 if r != 0 { 9187 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9188 } 9189 y = 1 9190 r = x << y 9191 if r != 0 { 9192 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9193 } 9194 y = 65535 9195 r = x << y 9196 if r != 0 { 9197 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 9198 } 9199 x = 1 9200 y = 0 9201 r = x << y 9202 if r != 1 { 9203 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9204 } 9205 y = 1 9206 r = x << y 9207 if r != 2 { 9208 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9209 } 9210 y = 65535 9211 r = x << y 9212 if r != 0 { 9213 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 9214 } 9215 x = 2147483647 9216 y = 0 9217 r = x << y 9218 if r != 2147483647 { 9219 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "<<", r) 9220 } 9221 y = 1 9222 r = x << y 9223 if r != -2 { 9224 t.Errorf("2147483647 %s 1 = %d, want -2", "<<", r) 9225 } 9226 y = 65535 9227 r = x << y 9228 if r != 0 { 9229 t.Errorf("2147483647 %s 65535 = %d, want 0", "<<", r) 9230 } 9231 } 9232 func TestConstFoldint32uint16rsh(t *testing.T) { 9233 var x, r int32 9234 var y uint16 9235 x = -2147483648 9236 y = 0 9237 r = x >> y 9238 if r != -2147483648 { 9239 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", ">>", r) 9240 } 9241 y = 1 9242 r = x >> y 9243 if r != -1073741824 { 9244 t.Errorf("-2147483648 %s 1 = %d, want -1073741824", ">>", r) 9245 } 9246 y = 65535 9247 r = x >> y 9248 if r != -1 { 9249 t.Errorf("-2147483648 %s 65535 = %d, want -1", ">>", r) 9250 } 9251 x = -2147483647 9252 y = 0 9253 r = x >> y 9254 if r != -2147483647 { 9255 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", ">>", r) 9256 } 9257 y = 1 9258 r = x >> y 9259 if r != -1073741824 { 9260 t.Errorf("-2147483647 %s 1 = %d, want -1073741824", ">>", r) 9261 } 9262 y = 65535 9263 r = x >> y 9264 if r != -1 { 9265 t.Errorf("-2147483647 %s 65535 = %d, want -1", ">>", r) 9266 } 9267 x = -1 9268 y = 0 9269 r = x >> y 9270 if r != -1 { 9271 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 9272 } 9273 y = 1 9274 r = x >> y 9275 if r != -1 { 9276 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 9277 } 9278 y = 65535 9279 r = x >> y 9280 if r != -1 { 9281 t.Errorf("-1 %s 65535 = %d, want -1", ">>", r) 9282 } 9283 x = 0 9284 y = 0 9285 r = x >> y 9286 if r != 0 { 9287 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9288 } 9289 y = 1 9290 r = x >> y 9291 if r != 0 { 9292 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9293 } 9294 y = 65535 9295 r = x >> y 9296 if r != 0 { 9297 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 9298 } 9299 x = 1 9300 y = 0 9301 r = x >> y 9302 if r != 1 { 9303 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9304 } 9305 y = 1 9306 r = x >> y 9307 if r != 0 { 9308 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9309 } 9310 y = 65535 9311 r = x >> y 9312 if r != 0 { 9313 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 9314 } 9315 x = 2147483647 9316 y = 0 9317 r = x >> y 9318 if r != 2147483647 { 9319 t.Errorf("2147483647 %s 0 = %d, want 2147483647", ">>", r) 9320 } 9321 y = 1 9322 r = x >> y 9323 if r != 1073741823 { 9324 t.Errorf("2147483647 %s 1 = %d, want 1073741823", ">>", r) 9325 } 9326 y = 65535 9327 r = x >> y 9328 if r != 0 { 9329 t.Errorf("2147483647 %s 65535 = %d, want 0", ">>", r) 9330 } 9331 } 9332 func TestConstFoldint32uint8lsh(t *testing.T) { 9333 var x, r int32 9334 var y uint8 9335 x = -2147483648 9336 y = 0 9337 r = x << y 9338 if r != -2147483648 { 9339 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "<<", r) 9340 } 9341 y = 1 9342 r = x << y 9343 if r != 0 { 9344 t.Errorf("-2147483648 %s 1 = %d, want 0", "<<", r) 9345 } 9346 y = 255 9347 r = x << y 9348 if r != 0 { 9349 t.Errorf("-2147483648 %s 255 = %d, want 0", "<<", r) 9350 } 9351 x = -2147483647 9352 y = 0 9353 r = x << y 9354 if r != -2147483647 { 9355 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "<<", r) 9356 } 9357 y = 1 9358 r = x << y 9359 if r != 2 { 9360 t.Errorf("-2147483647 %s 1 = %d, want 2", "<<", r) 9361 } 9362 y = 255 9363 r = x << y 9364 if r != 0 { 9365 t.Errorf("-2147483647 %s 255 = %d, want 0", "<<", r) 9366 } 9367 x = -1 9368 y = 0 9369 r = x << y 9370 if r != -1 { 9371 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 9372 } 9373 y = 1 9374 r = x << y 9375 if r != -2 { 9376 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 9377 } 9378 y = 255 9379 r = x << y 9380 if r != 0 { 9381 t.Errorf("-1 %s 255 = %d, want 0", "<<", r) 9382 } 9383 x = 0 9384 y = 0 9385 r = x << y 9386 if r != 0 { 9387 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9388 } 9389 y = 1 9390 r = x << y 9391 if r != 0 { 9392 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9393 } 9394 y = 255 9395 r = x << y 9396 if r != 0 { 9397 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 9398 } 9399 x = 1 9400 y = 0 9401 r = x << y 9402 if r != 1 { 9403 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9404 } 9405 y = 1 9406 r = x << y 9407 if r != 2 { 9408 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9409 } 9410 y = 255 9411 r = x << y 9412 if r != 0 { 9413 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 9414 } 9415 x = 2147483647 9416 y = 0 9417 r = x << y 9418 if r != 2147483647 { 9419 t.Errorf("2147483647 %s 0 = %d, want 2147483647", "<<", r) 9420 } 9421 y = 1 9422 r = x << y 9423 if r != -2 { 9424 t.Errorf("2147483647 %s 1 = %d, want -2", "<<", r) 9425 } 9426 y = 255 9427 r = x << y 9428 if r != 0 { 9429 t.Errorf("2147483647 %s 255 = %d, want 0", "<<", r) 9430 } 9431 } 9432 func TestConstFoldint32uint8rsh(t *testing.T) { 9433 var x, r int32 9434 var y uint8 9435 x = -2147483648 9436 y = 0 9437 r = x >> y 9438 if r != -2147483648 { 9439 t.Errorf("-2147483648 %s 0 = %d, want -2147483648", ">>", r) 9440 } 9441 y = 1 9442 r = x >> y 9443 if r != -1073741824 { 9444 t.Errorf("-2147483648 %s 1 = %d, want -1073741824", ">>", r) 9445 } 9446 y = 255 9447 r = x >> y 9448 if r != -1 { 9449 t.Errorf("-2147483648 %s 255 = %d, want -1", ">>", r) 9450 } 9451 x = -2147483647 9452 y = 0 9453 r = x >> y 9454 if r != -2147483647 { 9455 t.Errorf("-2147483647 %s 0 = %d, want -2147483647", ">>", r) 9456 } 9457 y = 1 9458 r = x >> y 9459 if r != -1073741824 { 9460 t.Errorf("-2147483647 %s 1 = %d, want -1073741824", ">>", r) 9461 } 9462 y = 255 9463 r = x >> y 9464 if r != -1 { 9465 t.Errorf("-2147483647 %s 255 = %d, want -1", ">>", r) 9466 } 9467 x = -1 9468 y = 0 9469 r = x >> y 9470 if r != -1 { 9471 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 9472 } 9473 y = 1 9474 r = x >> y 9475 if r != -1 { 9476 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 9477 } 9478 y = 255 9479 r = x >> y 9480 if r != -1 { 9481 t.Errorf("-1 %s 255 = %d, want -1", ">>", r) 9482 } 9483 x = 0 9484 y = 0 9485 r = x >> y 9486 if r != 0 { 9487 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9488 } 9489 y = 1 9490 r = x >> y 9491 if r != 0 { 9492 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9493 } 9494 y = 255 9495 r = x >> y 9496 if r != 0 { 9497 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 9498 } 9499 x = 1 9500 y = 0 9501 r = x >> y 9502 if r != 1 { 9503 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9504 } 9505 y = 1 9506 r = x >> y 9507 if r != 0 { 9508 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9509 } 9510 y = 255 9511 r = x >> y 9512 if r != 0 { 9513 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 9514 } 9515 x = 2147483647 9516 y = 0 9517 r = x >> y 9518 if r != 2147483647 { 9519 t.Errorf("2147483647 %s 0 = %d, want 2147483647", ">>", r) 9520 } 9521 y = 1 9522 r = x >> y 9523 if r != 1073741823 { 9524 t.Errorf("2147483647 %s 1 = %d, want 1073741823", ">>", r) 9525 } 9526 y = 255 9527 r = x >> y 9528 if r != 0 { 9529 t.Errorf("2147483647 %s 255 = %d, want 0", ">>", r) 9530 } 9531 } 9532 func TestConstFolduint16uint64lsh(t *testing.T) { 9533 var x, r uint16 9534 var y uint64 9535 x = 0 9536 y = 0 9537 r = x << y 9538 if r != 0 { 9539 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9540 } 9541 y = 1 9542 r = x << y 9543 if r != 0 { 9544 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9545 } 9546 y = 4294967296 9547 r = x << y 9548 if r != 0 { 9549 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 9550 } 9551 y = 18446744073709551615 9552 r = x << y 9553 if r != 0 { 9554 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 9555 } 9556 x = 1 9557 y = 0 9558 r = x << y 9559 if r != 1 { 9560 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9561 } 9562 y = 1 9563 r = x << y 9564 if r != 2 { 9565 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9566 } 9567 y = 4294967296 9568 r = x << y 9569 if r != 0 { 9570 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 9571 } 9572 y = 18446744073709551615 9573 r = x << y 9574 if r != 0 { 9575 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 9576 } 9577 x = 65535 9578 y = 0 9579 r = x << y 9580 if r != 65535 { 9581 t.Errorf("65535 %s 0 = %d, want 65535", "<<", r) 9582 } 9583 y = 1 9584 r = x << y 9585 if r != 65534 { 9586 t.Errorf("65535 %s 1 = %d, want 65534", "<<", r) 9587 } 9588 y = 4294967296 9589 r = x << y 9590 if r != 0 { 9591 t.Errorf("65535 %s 4294967296 = %d, want 0", "<<", r) 9592 } 9593 y = 18446744073709551615 9594 r = x << y 9595 if r != 0 { 9596 t.Errorf("65535 %s 18446744073709551615 = %d, want 0", "<<", r) 9597 } 9598 } 9599 func TestConstFolduint16uint64rsh(t *testing.T) { 9600 var x, r uint16 9601 var y uint64 9602 x = 0 9603 y = 0 9604 r = x >> y 9605 if r != 0 { 9606 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9607 } 9608 y = 1 9609 r = x >> y 9610 if r != 0 { 9611 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9612 } 9613 y = 4294967296 9614 r = x >> y 9615 if r != 0 { 9616 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 9617 } 9618 y = 18446744073709551615 9619 r = x >> y 9620 if r != 0 { 9621 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 9622 } 9623 x = 1 9624 y = 0 9625 r = x >> y 9626 if r != 1 { 9627 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9628 } 9629 y = 1 9630 r = x >> y 9631 if r != 0 { 9632 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9633 } 9634 y = 4294967296 9635 r = x >> y 9636 if r != 0 { 9637 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 9638 } 9639 y = 18446744073709551615 9640 r = x >> y 9641 if r != 0 { 9642 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 9643 } 9644 x = 65535 9645 y = 0 9646 r = x >> y 9647 if r != 65535 { 9648 t.Errorf("65535 %s 0 = %d, want 65535", ">>", r) 9649 } 9650 y = 1 9651 r = x >> y 9652 if r != 32767 { 9653 t.Errorf("65535 %s 1 = %d, want 32767", ">>", r) 9654 } 9655 y = 4294967296 9656 r = x >> y 9657 if r != 0 { 9658 t.Errorf("65535 %s 4294967296 = %d, want 0", ">>", r) 9659 } 9660 y = 18446744073709551615 9661 r = x >> y 9662 if r != 0 { 9663 t.Errorf("65535 %s 18446744073709551615 = %d, want 0", ">>", r) 9664 } 9665 } 9666 func TestConstFolduint16uint32lsh(t *testing.T) { 9667 var x, r uint16 9668 var y uint32 9669 x = 0 9670 y = 0 9671 r = x << y 9672 if r != 0 { 9673 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9674 } 9675 y = 1 9676 r = x << y 9677 if r != 0 { 9678 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9679 } 9680 y = 4294967295 9681 r = x << y 9682 if r != 0 { 9683 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 9684 } 9685 x = 1 9686 y = 0 9687 r = x << y 9688 if r != 1 { 9689 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9690 } 9691 y = 1 9692 r = x << y 9693 if r != 2 { 9694 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9695 } 9696 y = 4294967295 9697 r = x << y 9698 if r != 0 { 9699 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 9700 } 9701 x = 65535 9702 y = 0 9703 r = x << y 9704 if r != 65535 { 9705 t.Errorf("65535 %s 0 = %d, want 65535", "<<", r) 9706 } 9707 y = 1 9708 r = x << y 9709 if r != 65534 { 9710 t.Errorf("65535 %s 1 = %d, want 65534", "<<", r) 9711 } 9712 y = 4294967295 9713 r = x << y 9714 if r != 0 { 9715 t.Errorf("65535 %s 4294967295 = %d, want 0", "<<", r) 9716 } 9717 } 9718 func TestConstFolduint16uint32rsh(t *testing.T) { 9719 var x, r uint16 9720 var y uint32 9721 x = 0 9722 y = 0 9723 r = x >> y 9724 if r != 0 { 9725 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9726 } 9727 y = 1 9728 r = x >> y 9729 if r != 0 { 9730 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9731 } 9732 y = 4294967295 9733 r = x >> y 9734 if r != 0 { 9735 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 9736 } 9737 x = 1 9738 y = 0 9739 r = x >> y 9740 if r != 1 { 9741 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9742 } 9743 y = 1 9744 r = x >> y 9745 if r != 0 { 9746 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9747 } 9748 y = 4294967295 9749 r = x >> y 9750 if r != 0 { 9751 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 9752 } 9753 x = 65535 9754 y = 0 9755 r = x >> y 9756 if r != 65535 { 9757 t.Errorf("65535 %s 0 = %d, want 65535", ">>", r) 9758 } 9759 y = 1 9760 r = x >> y 9761 if r != 32767 { 9762 t.Errorf("65535 %s 1 = %d, want 32767", ">>", r) 9763 } 9764 y = 4294967295 9765 r = x >> y 9766 if r != 0 { 9767 t.Errorf("65535 %s 4294967295 = %d, want 0", ">>", r) 9768 } 9769 } 9770 func TestConstFolduint16uint16lsh(t *testing.T) { 9771 var x, r uint16 9772 var y uint16 9773 x = 0 9774 y = 0 9775 r = x << y 9776 if r != 0 { 9777 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9778 } 9779 y = 1 9780 r = x << y 9781 if r != 0 { 9782 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9783 } 9784 y = 65535 9785 r = x << y 9786 if r != 0 { 9787 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 9788 } 9789 x = 1 9790 y = 0 9791 r = x << y 9792 if r != 1 { 9793 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9794 } 9795 y = 1 9796 r = x << y 9797 if r != 2 { 9798 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9799 } 9800 y = 65535 9801 r = x << y 9802 if r != 0 { 9803 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 9804 } 9805 x = 65535 9806 y = 0 9807 r = x << y 9808 if r != 65535 { 9809 t.Errorf("65535 %s 0 = %d, want 65535", "<<", r) 9810 } 9811 y = 1 9812 r = x << y 9813 if r != 65534 { 9814 t.Errorf("65535 %s 1 = %d, want 65534", "<<", r) 9815 } 9816 y = 65535 9817 r = x << y 9818 if r != 0 { 9819 t.Errorf("65535 %s 65535 = %d, want 0", "<<", r) 9820 } 9821 } 9822 func TestConstFolduint16uint16rsh(t *testing.T) { 9823 var x, r uint16 9824 var y uint16 9825 x = 0 9826 y = 0 9827 r = x >> y 9828 if r != 0 { 9829 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9830 } 9831 y = 1 9832 r = x >> y 9833 if r != 0 { 9834 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9835 } 9836 y = 65535 9837 r = x >> y 9838 if r != 0 { 9839 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 9840 } 9841 x = 1 9842 y = 0 9843 r = x >> y 9844 if r != 1 { 9845 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9846 } 9847 y = 1 9848 r = x >> y 9849 if r != 0 { 9850 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9851 } 9852 y = 65535 9853 r = x >> y 9854 if r != 0 { 9855 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 9856 } 9857 x = 65535 9858 y = 0 9859 r = x >> y 9860 if r != 65535 { 9861 t.Errorf("65535 %s 0 = %d, want 65535", ">>", r) 9862 } 9863 y = 1 9864 r = x >> y 9865 if r != 32767 { 9866 t.Errorf("65535 %s 1 = %d, want 32767", ">>", r) 9867 } 9868 y = 65535 9869 r = x >> y 9870 if r != 0 { 9871 t.Errorf("65535 %s 65535 = %d, want 0", ">>", r) 9872 } 9873 } 9874 func TestConstFolduint16uint8lsh(t *testing.T) { 9875 var x, r uint16 9876 var y uint8 9877 x = 0 9878 y = 0 9879 r = x << y 9880 if r != 0 { 9881 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 9882 } 9883 y = 1 9884 r = x << y 9885 if r != 0 { 9886 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 9887 } 9888 y = 255 9889 r = x << y 9890 if r != 0 { 9891 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 9892 } 9893 x = 1 9894 y = 0 9895 r = x << y 9896 if r != 1 { 9897 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 9898 } 9899 y = 1 9900 r = x << y 9901 if r != 2 { 9902 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 9903 } 9904 y = 255 9905 r = x << y 9906 if r != 0 { 9907 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 9908 } 9909 x = 65535 9910 y = 0 9911 r = x << y 9912 if r != 65535 { 9913 t.Errorf("65535 %s 0 = %d, want 65535", "<<", r) 9914 } 9915 y = 1 9916 r = x << y 9917 if r != 65534 { 9918 t.Errorf("65535 %s 1 = %d, want 65534", "<<", r) 9919 } 9920 y = 255 9921 r = x << y 9922 if r != 0 { 9923 t.Errorf("65535 %s 255 = %d, want 0", "<<", r) 9924 } 9925 } 9926 func TestConstFolduint16uint8rsh(t *testing.T) { 9927 var x, r uint16 9928 var y uint8 9929 x = 0 9930 y = 0 9931 r = x >> y 9932 if r != 0 { 9933 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 9934 } 9935 y = 1 9936 r = x >> y 9937 if r != 0 { 9938 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 9939 } 9940 y = 255 9941 r = x >> y 9942 if r != 0 { 9943 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 9944 } 9945 x = 1 9946 y = 0 9947 r = x >> y 9948 if r != 1 { 9949 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 9950 } 9951 y = 1 9952 r = x >> y 9953 if r != 0 { 9954 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 9955 } 9956 y = 255 9957 r = x >> y 9958 if r != 0 { 9959 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 9960 } 9961 x = 65535 9962 y = 0 9963 r = x >> y 9964 if r != 65535 { 9965 t.Errorf("65535 %s 0 = %d, want 65535", ">>", r) 9966 } 9967 y = 1 9968 r = x >> y 9969 if r != 32767 { 9970 t.Errorf("65535 %s 1 = %d, want 32767", ">>", r) 9971 } 9972 y = 255 9973 r = x >> y 9974 if r != 0 { 9975 t.Errorf("65535 %s 255 = %d, want 0", ">>", r) 9976 } 9977 } 9978 func TestConstFoldint16uint64lsh(t *testing.T) { 9979 var x, r int16 9980 var y uint64 9981 x = -32768 9982 y = 0 9983 r = x << y 9984 if r != -32768 { 9985 t.Errorf("-32768 %s 0 = %d, want -32768", "<<", r) 9986 } 9987 y = 1 9988 r = x << y 9989 if r != 0 { 9990 t.Errorf("-32768 %s 1 = %d, want 0", "<<", r) 9991 } 9992 y = 4294967296 9993 r = x << y 9994 if r != 0 { 9995 t.Errorf("-32768 %s 4294967296 = %d, want 0", "<<", r) 9996 } 9997 y = 18446744073709551615 9998 r = x << y 9999 if r != 0 { 10000 t.Errorf("-32768 %s 18446744073709551615 = %d, want 0", "<<", r) 10001 } 10002 x = -32767 10003 y = 0 10004 r = x << y 10005 if r != -32767 { 10006 t.Errorf("-32767 %s 0 = %d, want -32767", "<<", r) 10007 } 10008 y = 1 10009 r = x << y 10010 if r != 2 { 10011 t.Errorf("-32767 %s 1 = %d, want 2", "<<", r) 10012 } 10013 y = 4294967296 10014 r = x << y 10015 if r != 0 { 10016 t.Errorf("-32767 %s 4294967296 = %d, want 0", "<<", r) 10017 } 10018 y = 18446744073709551615 10019 r = x << y 10020 if r != 0 { 10021 t.Errorf("-32767 %s 18446744073709551615 = %d, want 0", "<<", r) 10022 } 10023 x = -1 10024 y = 0 10025 r = x << y 10026 if r != -1 { 10027 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 10028 } 10029 y = 1 10030 r = x << y 10031 if r != -2 { 10032 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 10033 } 10034 y = 4294967296 10035 r = x << y 10036 if r != 0 { 10037 t.Errorf("-1 %s 4294967296 = %d, want 0", "<<", r) 10038 } 10039 y = 18446744073709551615 10040 r = x << y 10041 if r != 0 { 10042 t.Errorf("-1 %s 18446744073709551615 = %d, want 0", "<<", r) 10043 } 10044 x = 0 10045 y = 0 10046 r = x << y 10047 if r != 0 { 10048 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 10049 } 10050 y = 1 10051 r = x << y 10052 if r != 0 { 10053 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 10054 } 10055 y = 4294967296 10056 r = x << y 10057 if r != 0 { 10058 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 10059 } 10060 y = 18446744073709551615 10061 r = x << y 10062 if r != 0 { 10063 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 10064 } 10065 x = 1 10066 y = 0 10067 r = x << y 10068 if r != 1 { 10069 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 10070 } 10071 y = 1 10072 r = x << y 10073 if r != 2 { 10074 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 10075 } 10076 y = 4294967296 10077 r = x << y 10078 if r != 0 { 10079 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 10080 } 10081 y = 18446744073709551615 10082 r = x << y 10083 if r != 0 { 10084 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 10085 } 10086 x = 32766 10087 y = 0 10088 r = x << y 10089 if r != 32766 { 10090 t.Errorf("32766 %s 0 = %d, want 32766", "<<", r) 10091 } 10092 y = 1 10093 r = x << y 10094 if r != -4 { 10095 t.Errorf("32766 %s 1 = %d, want -4", "<<", r) 10096 } 10097 y = 4294967296 10098 r = x << y 10099 if r != 0 { 10100 t.Errorf("32766 %s 4294967296 = %d, want 0", "<<", r) 10101 } 10102 y = 18446744073709551615 10103 r = x << y 10104 if r != 0 { 10105 t.Errorf("32766 %s 18446744073709551615 = %d, want 0", "<<", r) 10106 } 10107 x = 32767 10108 y = 0 10109 r = x << y 10110 if r != 32767 { 10111 t.Errorf("32767 %s 0 = %d, want 32767", "<<", r) 10112 } 10113 y = 1 10114 r = x << y 10115 if r != -2 { 10116 t.Errorf("32767 %s 1 = %d, want -2", "<<", r) 10117 } 10118 y = 4294967296 10119 r = x << y 10120 if r != 0 { 10121 t.Errorf("32767 %s 4294967296 = %d, want 0", "<<", r) 10122 } 10123 y = 18446744073709551615 10124 r = x << y 10125 if r != 0 { 10126 t.Errorf("32767 %s 18446744073709551615 = %d, want 0", "<<", r) 10127 } 10128 } 10129 func TestConstFoldint16uint64rsh(t *testing.T) { 10130 var x, r int16 10131 var y uint64 10132 x = -32768 10133 y = 0 10134 r = x >> y 10135 if r != -32768 { 10136 t.Errorf("-32768 %s 0 = %d, want -32768", ">>", r) 10137 } 10138 y = 1 10139 r = x >> y 10140 if r != -16384 { 10141 t.Errorf("-32768 %s 1 = %d, want -16384", ">>", r) 10142 } 10143 y = 4294967296 10144 r = x >> y 10145 if r != -1 { 10146 t.Errorf("-32768 %s 4294967296 = %d, want -1", ">>", r) 10147 } 10148 y = 18446744073709551615 10149 r = x >> y 10150 if r != -1 { 10151 t.Errorf("-32768 %s 18446744073709551615 = %d, want -1", ">>", r) 10152 } 10153 x = -32767 10154 y = 0 10155 r = x >> y 10156 if r != -32767 { 10157 t.Errorf("-32767 %s 0 = %d, want -32767", ">>", r) 10158 } 10159 y = 1 10160 r = x >> y 10161 if r != -16384 { 10162 t.Errorf("-32767 %s 1 = %d, want -16384", ">>", r) 10163 } 10164 y = 4294967296 10165 r = x >> y 10166 if r != -1 { 10167 t.Errorf("-32767 %s 4294967296 = %d, want -1", ">>", r) 10168 } 10169 y = 18446744073709551615 10170 r = x >> y 10171 if r != -1 { 10172 t.Errorf("-32767 %s 18446744073709551615 = %d, want -1", ">>", r) 10173 } 10174 x = -1 10175 y = 0 10176 r = x >> y 10177 if r != -1 { 10178 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 10179 } 10180 y = 1 10181 r = x >> y 10182 if r != -1 { 10183 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 10184 } 10185 y = 4294967296 10186 r = x >> y 10187 if r != -1 { 10188 t.Errorf("-1 %s 4294967296 = %d, want -1", ">>", r) 10189 } 10190 y = 18446744073709551615 10191 r = x >> y 10192 if r != -1 { 10193 t.Errorf("-1 %s 18446744073709551615 = %d, want -1", ">>", r) 10194 } 10195 x = 0 10196 y = 0 10197 r = x >> y 10198 if r != 0 { 10199 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 10200 } 10201 y = 1 10202 r = x >> y 10203 if r != 0 { 10204 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 10205 } 10206 y = 4294967296 10207 r = x >> y 10208 if r != 0 { 10209 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 10210 } 10211 y = 18446744073709551615 10212 r = x >> y 10213 if r != 0 { 10214 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 10215 } 10216 x = 1 10217 y = 0 10218 r = x >> y 10219 if r != 1 { 10220 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 10221 } 10222 y = 1 10223 r = x >> y 10224 if r != 0 { 10225 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 10226 } 10227 y = 4294967296 10228 r = x >> y 10229 if r != 0 { 10230 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 10231 } 10232 y = 18446744073709551615 10233 r = x >> y 10234 if r != 0 { 10235 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 10236 } 10237 x = 32766 10238 y = 0 10239 r = x >> y 10240 if r != 32766 { 10241 t.Errorf("32766 %s 0 = %d, want 32766", ">>", r) 10242 } 10243 y = 1 10244 r = x >> y 10245 if r != 16383 { 10246 t.Errorf("32766 %s 1 = %d, want 16383", ">>", r) 10247 } 10248 y = 4294967296 10249 r = x >> y 10250 if r != 0 { 10251 t.Errorf("32766 %s 4294967296 = %d, want 0", ">>", r) 10252 } 10253 y = 18446744073709551615 10254 r = x >> y 10255 if r != 0 { 10256 t.Errorf("32766 %s 18446744073709551615 = %d, want 0", ">>", r) 10257 } 10258 x = 32767 10259 y = 0 10260 r = x >> y 10261 if r != 32767 { 10262 t.Errorf("32767 %s 0 = %d, want 32767", ">>", r) 10263 } 10264 y = 1 10265 r = x >> y 10266 if r != 16383 { 10267 t.Errorf("32767 %s 1 = %d, want 16383", ">>", r) 10268 } 10269 y = 4294967296 10270 r = x >> y 10271 if r != 0 { 10272 t.Errorf("32767 %s 4294967296 = %d, want 0", ">>", r) 10273 } 10274 y = 18446744073709551615 10275 r = x >> y 10276 if r != 0 { 10277 t.Errorf("32767 %s 18446744073709551615 = %d, want 0", ">>", r) 10278 } 10279 } 10280 func TestConstFoldint16uint32lsh(t *testing.T) { 10281 var x, r int16 10282 var y uint32 10283 x = -32768 10284 y = 0 10285 r = x << y 10286 if r != -32768 { 10287 t.Errorf("-32768 %s 0 = %d, want -32768", "<<", r) 10288 } 10289 y = 1 10290 r = x << y 10291 if r != 0 { 10292 t.Errorf("-32768 %s 1 = %d, want 0", "<<", r) 10293 } 10294 y = 4294967295 10295 r = x << y 10296 if r != 0 { 10297 t.Errorf("-32768 %s 4294967295 = %d, want 0", "<<", r) 10298 } 10299 x = -32767 10300 y = 0 10301 r = x << y 10302 if r != -32767 { 10303 t.Errorf("-32767 %s 0 = %d, want -32767", "<<", r) 10304 } 10305 y = 1 10306 r = x << y 10307 if r != 2 { 10308 t.Errorf("-32767 %s 1 = %d, want 2", "<<", r) 10309 } 10310 y = 4294967295 10311 r = x << y 10312 if r != 0 { 10313 t.Errorf("-32767 %s 4294967295 = %d, want 0", "<<", r) 10314 } 10315 x = -1 10316 y = 0 10317 r = x << y 10318 if r != -1 { 10319 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 10320 } 10321 y = 1 10322 r = x << y 10323 if r != -2 { 10324 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 10325 } 10326 y = 4294967295 10327 r = x << y 10328 if r != 0 { 10329 t.Errorf("-1 %s 4294967295 = %d, want 0", "<<", r) 10330 } 10331 x = 0 10332 y = 0 10333 r = x << y 10334 if r != 0 { 10335 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 10336 } 10337 y = 1 10338 r = x << y 10339 if r != 0 { 10340 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 10341 } 10342 y = 4294967295 10343 r = x << y 10344 if r != 0 { 10345 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 10346 } 10347 x = 1 10348 y = 0 10349 r = x << y 10350 if r != 1 { 10351 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 10352 } 10353 y = 1 10354 r = x << y 10355 if r != 2 { 10356 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 10357 } 10358 y = 4294967295 10359 r = x << y 10360 if r != 0 { 10361 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 10362 } 10363 x = 32766 10364 y = 0 10365 r = x << y 10366 if r != 32766 { 10367 t.Errorf("32766 %s 0 = %d, want 32766", "<<", r) 10368 } 10369 y = 1 10370 r = x << y 10371 if r != -4 { 10372 t.Errorf("32766 %s 1 = %d, want -4", "<<", r) 10373 } 10374 y = 4294967295 10375 r = x << y 10376 if r != 0 { 10377 t.Errorf("32766 %s 4294967295 = %d, want 0", "<<", r) 10378 } 10379 x = 32767 10380 y = 0 10381 r = x << y 10382 if r != 32767 { 10383 t.Errorf("32767 %s 0 = %d, want 32767", "<<", r) 10384 } 10385 y = 1 10386 r = x << y 10387 if r != -2 { 10388 t.Errorf("32767 %s 1 = %d, want -2", "<<", r) 10389 } 10390 y = 4294967295 10391 r = x << y 10392 if r != 0 { 10393 t.Errorf("32767 %s 4294967295 = %d, want 0", "<<", r) 10394 } 10395 } 10396 func TestConstFoldint16uint32rsh(t *testing.T) { 10397 var x, r int16 10398 var y uint32 10399 x = -32768 10400 y = 0 10401 r = x >> y 10402 if r != -32768 { 10403 t.Errorf("-32768 %s 0 = %d, want -32768", ">>", r) 10404 } 10405 y = 1 10406 r = x >> y 10407 if r != -16384 { 10408 t.Errorf("-32768 %s 1 = %d, want -16384", ">>", r) 10409 } 10410 y = 4294967295 10411 r = x >> y 10412 if r != -1 { 10413 t.Errorf("-32768 %s 4294967295 = %d, want -1", ">>", r) 10414 } 10415 x = -32767 10416 y = 0 10417 r = x >> y 10418 if r != -32767 { 10419 t.Errorf("-32767 %s 0 = %d, want -32767", ">>", r) 10420 } 10421 y = 1 10422 r = x >> y 10423 if r != -16384 { 10424 t.Errorf("-32767 %s 1 = %d, want -16384", ">>", r) 10425 } 10426 y = 4294967295 10427 r = x >> y 10428 if r != -1 { 10429 t.Errorf("-32767 %s 4294967295 = %d, want -1", ">>", r) 10430 } 10431 x = -1 10432 y = 0 10433 r = x >> y 10434 if r != -1 { 10435 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 10436 } 10437 y = 1 10438 r = x >> y 10439 if r != -1 { 10440 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 10441 } 10442 y = 4294967295 10443 r = x >> y 10444 if r != -1 { 10445 t.Errorf("-1 %s 4294967295 = %d, want -1", ">>", r) 10446 } 10447 x = 0 10448 y = 0 10449 r = x >> y 10450 if r != 0 { 10451 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 10452 } 10453 y = 1 10454 r = x >> y 10455 if r != 0 { 10456 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 10457 } 10458 y = 4294967295 10459 r = x >> y 10460 if r != 0 { 10461 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 10462 } 10463 x = 1 10464 y = 0 10465 r = x >> y 10466 if r != 1 { 10467 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 10468 } 10469 y = 1 10470 r = x >> y 10471 if r != 0 { 10472 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 10473 } 10474 y = 4294967295 10475 r = x >> y 10476 if r != 0 { 10477 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 10478 } 10479 x = 32766 10480 y = 0 10481 r = x >> y 10482 if r != 32766 { 10483 t.Errorf("32766 %s 0 = %d, want 32766", ">>", r) 10484 } 10485 y = 1 10486 r = x >> y 10487 if r != 16383 { 10488 t.Errorf("32766 %s 1 = %d, want 16383", ">>", r) 10489 } 10490 y = 4294967295 10491 r = x >> y 10492 if r != 0 { 10493 t.Errorf("32766 %s 4294967295 = %d, want 0", ">>", r) 10494 } 10495 x = 32767 10496 y = 0 10497 r = x >> y 10498 if r != 32767 { 10499 t.Errorf("32767 %s 0 = %d, want 32767", ">>", r) 10500 } 10501 y = 1 10502 r = x >> y 10503 if r != 16383 { 10504 t.Errorf("32767 %s 1 = %d, want 16383", ">>", r) 10505 } 10506 y = 4294967295 10507 r = x >> y 10508 if r != 0 { 10509 t.Errorf("32767 %s 4294967295 = %d, want 0", ">>", r) 10510 } 10511 } 10512 func TestConstFoldint16uint16lsh(t *testing.T) { 10513 var x, r int16 10514 var y uint16 10515 x = -32768 10516 y = 0 10517 r = x << y 10518 if r != -32768 { 10519 t.Errorf("-32768 %s 0 = %d, want -32768", "<<", r) 10520 } 10521 y = 1 10522 r = x << y 10523 if r != 0 { 10524 t.Errorf("-32768 %s 1 = %d, want 0", "<<", r) 10525 } 10526 y = 65535 10527 r = x << y 10528 if r != 0 { 10529 t.Errorf("-32768 %s 65535 = %d, want 0", "<<", r) 10530 } 10531 x = -32767 10532 y = 0 10533 r = x << y 10534 if r != -32767 { 10535 t.Errorf("-32767 %s 0 = %d, want -32767", "<<", r) 10536 } 10537 y = 1 10538 r = x << y 10539 if r != 2 { 10540 t.Errorf("-32767 %s 1 = %d, want 2", "<<", r) 10541 } 10542 y = 65535 10543 r = x << y 10544 if r != 0 { 10545 t.Errorf("-32767 %s 65535 = %d, want 0", "<<", r) 10546 } 10547 x = -1 10548 y = 0 10549 r = x << y 10550 if r != -1 { 10551 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 10552 } 10553 y = 1 10554 r = x << y 10555 if r != -2 { 10556 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 10557 } 10558 y = 65535 10559 r = x << y 10560 if r != 0 { 10561 t.Errorf("-1 %s 65535 = %d, want 0", "<<", r) 10562 } 10563 x = 0 10564 y = 0 10565 r = x << y 10566 if r != 0 { 10567 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 10568 } 10569 y = 1 10570 r = x << y 10571 if r != 0 { 10572 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 10573 } 10574 y = 65535 10575 r = x << y 10576 if r != 0 { 10577 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 10578 } 10579 x = 1 10580 y = 0 10581 r = x << y 10582 if r != 1 { 10583 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 10584 } 10585 y = 1 10586 r = x << y 10587 if r != 2 { 10588 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 10589 } 10590 y = 65535 10591 r = x << y 10592 if r != 0 { 10593 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 10594 } 10595 x = 32766 10596 y = 0 10597 r = x << y 10598 if r != 32766 { 10599 t.Errorf("32766 %s 0 = %d, want 32766", "<<", r) 10600 } 10601 y = 1 10602 r = x << y 10603 if r != -4 { 10604 t.Errorf("32766 %s 1 = %d, want -4", "<<", r) 10605 } 10606 y = 65535 10607 r = x << y 10608 if r != 0 { 10609 t.Errorf("32766 %s 65535 = %d, want 0", "<<", r) 10610 } 10611 x = 32767 10612 y = 0 10613 r = x << y 10614 if r != 32767 { 10615 t.Errorf("32767 %s 0 = %d, want 32767", "<<", r) 10616 } 10617 y = 1 10618 r = x << y 10619 if r != -2 { 10620 t.Errorf("32767 %s 1 = %d, want -2", "<<", r) 10621 } 10622 y = 65535 10623 r = x << y 10624 if r != 0 { 10625 t.Errorf("32767 %s 65535 = %d, want 0", "<<", r) 10626 } 10627 } 10628 func TestConstFoldint16uint16rsh(t *testing.T) { 10629 var x, r int16 10630 var y uint16 10631 x = -32768 10632 y = 0 10633 r = x >> y 10634 if r != -32768 { 10635 t.Errorf("-32768 %s 0 = %d, want -32768", ">>", r) 10636 } 10637 y = 1 10638 r = x >> y 10639 if r != -16384 { 10640 t.Errorf("-32768 %s 1 = %d, want -16384", ">>", r) 10641 } 10642 y = 65535 10643 r = x >> y 10644 if r != -1 { 10645 t.Errorf("-32768 %s 65535 = %d, want -1", ">>", r) 10646 } 10647 x = -32767 10648 y = 0 10649 r = x >> y 10650 if r != -32767 { 10651 t.Errorf("-32767 %s 0 = %d, want -32767", ">>", r) 10652 } 10653 y = 1 10654 r = x >> y 10655 if r != -16384 { 10656 t.Errorf("-32767 %s 1 = %d, want -16384", ">>", r) 10657 } 10658 y = 65535 10659 r = x >> y 10660 if r != -1 { 10661 t.Errorf("-32767 %s 65535 = %d, want -1", ">>", r) 10662 } 10663 x = -1 10664 y = 0 10665 r = x >> y 10666 if r != -1 { 10667 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 10668 } 10669 y = 1 10670 r = x >> y 10671 if r != -1 { 10672 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 10673 } 10674 y = 65535 10675 r = x >> y 10676 if r != -1 { 10677 t.Errorf("-1 %s 65535 = %d, want -1", ">>", r) 10678 } 10679 x = 0 10680 y = 0 10681 r = x >> y 10682 if r != 0 { 10683 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 10684 } 10685 y = 1 10686 r = x >> y 10687 if r != 0 { 10688 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 10689 } 10690 y = 65535 10691 r = x >> y 10692 if r != 0 { 10693 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 10694 } 10695 x = 1 10696 y = 0 10697 r = x >> y 10698 if r != 1 { 10699 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 10700 } 10701 y = 1 10702 r = x >> y 10703 if r != 0 { 10704 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 10705 } 10706 y = 65535 10707 r = x >> y 10708 if r != 0 { 10709 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 10710 } 10711 x = 32766 10712 y = 0 10713 r = x >> y 10714 if r != 32766 { 10715 t.Errorf("32766 %s 0 = %d, want 32766", ">>", r) 10716 } 10717 y = 1 10718 r = x >> y 10719 if r != 16383 { 10720 t.Errorf("32766 %s 1 = %d, want 16383", ">>", r) 10721 } 10722 y = 65535 10723 r = x >> y 10724 if r != 0 { 10725 t.Errorf("32766 %s 65535 = %d, want 0", ">>", r) 10726 } 10727 x = 32767 10728 y = 0 10729 r = x >> y 10730 if r != 32767 { 10731 t.Errorf("32767 %s 0 = %d, want 32767", ">>", r) 10732 } 10733 y = 1 10734 r = x >> y 10735 if r != 16383 { 10736 t.Errorf("32767 %s 1 = %d, want 16383", ">>", r) 10737 } 10738 y = 65535 10739 r = x >> y 10740 if r != 0 { 10741 t.Errorf("32767 %s 65535 = %d, want 0", ">>", r) 10742 } 10743 } 10744 func TestConstFoldint16uint8lsh(t *testing.T) { 10745 var x, r int16 10746 var y uint8 10747 x = -32768 10748 y = 0 10749 r = x << y 10750 if r != -32768 { 10751 t.Errorf("-32768 %s 0 = %d, want -32768", "<<", r) 10752 } 10753 y = 1 10754 r = x << y 10755 if r != 0 { 10756 t.Errorf("-32768 %s 1 = %d, want 0", "<<", r) 10757 } 10758 y = 255 10759 r = x << y 10760 if r != 0 { 10761 t.Errorf("-32768 %s 255 = %d, want 0", "<<", r) 10762 } 10763 x = -32767 10764 y = 0 10765 r = x << y 10766 if r != -32767 { 10767 t.Errorf("-32767 %s 0 = %d, want -32767", "<<", r) 10768 } 10769 y = 1 10770 r = x << y 10771 if r != 2 { 10772 t.Errorf("-32767 %s 1 = %d, want 2", "<<", r) 10773 } 10774 y = 255 10775 r = x << y 10776 if r != 0 { 10777 t.Errorf("-32767 %s 255 = %d, want 0", "<<", r) 10778 } 10779 x = -1 10780 y = 0 10781 r = x << y 10782 if r != -1 { 10783 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 10784 } 10785 y = 1 10786 r = x << y 10787 if r != -2 { 10788 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 10789 } 10790 y = 255 10791 r = x << y 10792 if r != 0 { 10793 t.Errorf("-1 %s 255 = %d, want 0", "<<", r) 10794 } 10795 x = 0 10796 y = 0 10797 r = x << y 10798 if r != 0 { 10799 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 10800 } 10801 y = 1 10802 r = x << y 10803 if r != 0 { 10804 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 10805 } 10806 y = 255 10807 r = x << y 10808 if r != 0 { 10809 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 10810 } 10811 x = 1 10812 y = 0 10813 r = x << y 10814 if r != 1 { 10815 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 10816 } 10817 y = 1 10818 r = x << y 10819 if r != 2 { 10820 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 10821 } 10822 y = 255 10823 r = x << y 10824 if r != 0 { 10825 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 10826 } 10827 x = 32766 10828 y = 0 10829 r = x << y 10830 if r != 32766 { 10831 t.Errorf("32766 %s 0 = %d, want 32766", "<<", r) 10832 } 10833 y = 1 10834 r = x << y 10835 if r != -4 { 10836 t.Errorf("32766 %s 1 = %d, want -4", "<<", r) 10837 } 10838 y = 255 10839 r = x << y 10840 if r != 0 { 10841 t.Errorf("32766 %s 255 = %d, want 0", "<<", r) 10842 } 10843 x = 32767 10844 y = 0 10845 r = x << y 10846 if r != 32767 { 10847 t.Errorf("32767 %s 0 = %d, want 32767", "<<", r) 10848 } 10849 y = 1 10850 r = x << y 10851 if r != -2 { 10852 t.Errorf("32767 %s 1 = %d, want -2", "<<", r) 10853 } 10854 y = 255 10855 r = x << y 10856 if r != 0 { 10857 t.Errorf("32767 %s 255 = %d, want 0", "<<", r) 10858 } 10859 } 10860 func TestConstFoldint16uint8rsh(t *testing.T) { 10861 var x, r int16 10862 var y uint8 10863 x = -32768 10864 y = 0 10865 r = x >> y 10866 if r != -32768 { 10867 t.Errorf("-32768 %s 0 = %d, want -32768", ">>", r) 10868 } 10869 y = 1 10870 r = x >> y 10871 if r != -16384 { 10872 t.Errorf("-32768 %s 1 = %d, want -16384", ">>", r) 10873 } 10874 y = 255 10875 r = x >> y 10876 if r != -1 { 10877 t.Errorf("-32768 %s 255 = %d, want -1", ">>", r) 10878 } 10879 x = -32767 10880 y = 0 10881 r = x >> y 10882 if r != -32767 { 10883 t.Errorf("-32767 %s 0 = %d, want -32767", ">>", r) 10884 } 10885 y = 1 10886 r = x >> y 10887 if r != -16384 { 10888 t.Errorf("-32767 %s 1 = %d, want -16384", ">>", r) 10889 } 10890 y = 255 10891 r = x >> y 10892 if r != -1 { 10893 t.Errorf("-32767 %s 255 = %d, want -1", ">>", r) 10894 } 10895 x = -1 10896 y = 0 10897 r = x >> y 10898 if r != -1 { 10899 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 10900 } 10901 y = 1 10902 r = x >> y 10903 if r != -1 { 10904 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 10905 } 10906 y = 255 10907 r = x >> y 10908 if r != -1 { 10909 t.Errorf("-1 %s 255 = %d, want -1", ">>", r) 10910 } 10911 x = 0 10912 y = 0 10913 r = x >> y 10914 if r != 0 { 10915 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 10916 } 10917 y = 1 10918 r = x >> y 10919 if r != 0 { 10920 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 10921 } 10922 y = 255 10923 r = x >> y 10924 if r != 0 { 10925 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 10926 } 10927 x = 1 10928 y = 0 10929 r = x >> y 10930 if r != 1 { 10931 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 10932 } 10933 y = 1 10934 r = x >> y 10935 if r != 0 { 10936 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 10937 } 10938 y = 255 10939 r = x >> y 10940 if r != 0 { 10941 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 10942 } 10943 x = 32766 10944 y = 0 10945 r = x >> y 10946 if r != 32766 { 10947 t.Errorf("32766 %s 0 = %d, want 32766", ">>", r) 10948 } 10949 y = 1 10950 r = x >> y 10951 if r != 16383 { 10952 t.Errorf("32766 %s 1 = %d, want 16383", ">>", r) 10953 } 10954 y = 255 10955 r = x >> y 10956 if r != 0 { 10957 t.Errorf("32766 %s 255 = %d, want 0", ">>", r) 10958 } 10959 x = 32767 10960 y = 0 10961 r = x >> y 10962 if r != 32767 { 10963 t.Errorf("32767 %s 0 = %d, want 32767", ">>", r) 10964 } 10965 y = 1 10966 r = x >> y 10967 if r != 16383 { 10968 t.Errorf("32767 %s 1 = %d, want 16383", ">>", r) 10969 } 10970 y = 255 10971 r = x >> y 10972 if r != 0 { 10973 t.Errorf("32767 %s 255 = %d, want 0", ">>", r) 10974 } 10975 } 10976 func TestConstFolduint8uint64lsh(t *testing.T) { 10977 var x, r uint8 10978 var y uint64 10979 x = 0 10980 y = 0 10981 r = x << y 10982 if r != 0 { 10983 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 10984 } 10985 y = 1 10986 r = x << y 10987 if r != 0 { 10988 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 10989 } 10990 y = 4294967296 10991 r = x << y 10992 if r != 0 { 10993 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 10994 } 10995 y = 18446744073709551615 10996 r = x << y 10997 if r != 0 { 10998 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 10999 } 11000 x = 1 11001 y = 0 11002 r = x << y 11003 if r != 1 { 11004 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11005 } 11006 y = 1 11007 r = x << y 11008 if r != 2 { 11009 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11010 } 11011 y = 4294967296 11012 r = x << y 11013 if r != 0 { 11014 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 11015 } 11016 y = 18446744073709551615 11017 r = x << y 11018 if r != 0 { 11019 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 11020 } 11021 x = 255 11022 y = 0 11023 r = x << y 11024 if r != 255 { 11025 t.Errorf("255 %s 0 = %d, want 255", "<<", r) 11026 } 11027 y = 1 11028 r = x << y 11029 if r != 254 { 11030 t.Errorf("255 %s 1 = %d, want 254", "<<", r) 11031 } 11032 y = 4294967296 11033 r = x << y 11034 if r != 0 { 11035 t.Errorf("255 %s 4294967296 = %d, want 0", "<<", r) 11036 } 11037 y = 18446744073709551615 11038 r = x << y 11039 if r != 0 { 11040 t.Errorf("255 %s 18446744073709551615 = %d, want 0", "<<", r) 11041 } 11042 } 11043 func TestConstFolduint8uint64rsh(t *testing.T) { 11044 var x, r uint8 11045 var y uint64 11046 x = 0 11047 y = 0 11048 r = x >> y 11049 if r != 0 { 11050 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11051 } 11052 y = 1 11053 r = x >> y 11054 if r != 0 { 11055 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11056 } 11057 y = 4294967296 11058 r = x >> y 11059 if r != 0 { 11060 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 11061 } 11062 y = 18446744073709551615 11063 r = x >> y 11064 if r != 0 { 11065 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 11066 } 11067 x = 1 11068 y = 0 11069 r = x >> y 11070 if r != 1 { 11071 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11072 } 11073 y = 1 11074 r = x >> y 11075 if r != 0 { 11076 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11077 } 11078 y = 4294967296 11079 r = x >> y 11080 if r != 0 { 11081 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 11082 } 11083 y = 18446744073709551615 11084 r = x >> y 11085 if r != 0 { 11086 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 11087 } 11088 x = 255 11089 y = 0 11090 r = x >> y 11091 if r != 255 { 11092 t.Errorf("255 %s 0 = %d, want 255", ">>", r) 11093 } 11094 y = 1 11095 r = x >> y 11096 if r != 127 { 11097 t.Errorf("255 %s 1 = %d, want 127", ">>", r) 11098 } 11099 y = 4294967296 11100 r = x >> y 11101 if r != 0 { 11102 t.Errorf("255 %s 4294967296 = %d, want 0", ">>", r) 11103 } 11104 y = 18446744073709551615 11105 r = x >> y 11106 if r != 0 { 11107 t.Errorf("255 %s 18446744073709551615 = %d, want 0", ">>", r) 11108 } 11109 } 11110 func TestConstFolduint8uint32lsh(t *testing.T) { 11111 var x, r uint8 11112 var y uint32 11113 x = 0 11114 y = 0 11115 r = x << y 11116 if r != 0 { 11117 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 11118 } 11119 y = 1 11120 r = x << y 11121 if r != 0 { 11122 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 11123 } 11124 y = 4294967295 11125 r = x << y 11126 if r != 0 { 11127 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 11128 } 11129 x = 1 11130 y = 0 11131 r = x << y 11132 if r != 1 { 11133 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11134 } 11135 y = 1 11136 r = x << y 11137 if r != 2 { 11138 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11139 } 11140 y = 4294967295 11141 r = x << y 11142 if r != 0 { 11143 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 11144 } 11145 x = 255 11146 y = 0 11147 r = x << y 11148 if r != 255 { 11149 t.Errorf("255 %s 0 = %d, want 255", "<<", r) 11150 } 11151 y = 1 11152 r = x << y 11153 if r != 254 { 11154 t.Errorf("255 %s 1 = %d, want 254", "<<", r) 11155 } 11156 y = 4294967295 11157 r = x << y 11158 if r != 0 { 11159 t.Errorf("255 %s 4294967295 = %d, want 0", "<<", r) 11160 } 11161 } 11162 func TestConstFolduint8uint32rsh(t *testing.T) { 11163 var x, r uint8 11164 var y uint32 11165 x = 0 11166 y = 0 11167 r = x >> y 11168 if r != 0 { 11169 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11170 } 11171 y = 1 11172 r = x >> y 11173 if r != 0 { 11174 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11175 } 11176 y = 4294967295 11177 r = x >> y 11178 if r != 0 { 11179 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 11180 } 11181 x = 1 11182 y = 0 11183 r = x >> y 11184 if r != 1 { 11185 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11186 } 11187 y = 1 11188 r = x >> y 11189 if r != 0 { 11190 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11191 } 11192 y = 4294967295 11193 r = x >> y 11194 if r != 0 { 11195 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 11196 } 11197 x = 255 11198 y = 0 11199 r = x >> y 11200 if r != 255 { 11201 t.Errorf("255 %s 0 = %d, want 255", ">>", r) 11202 } 11203 y = 1 11204 r = x >> y 11205 if r != 127 { 11206 t.Errorf("255 %s 1 = %d, want 127", ">>", r) 11207 } 11208 y = 4294967295 11209 r = x >> y 11210 if r != 0 { 11211 t.Errorf("255 %s 4294967295 = %d, want 0", ">>", r) 11212 } 11213 } 11214 func TestConstFolduint8uint16lsh(t *testing.T) { 11215 var x, r uint8 11216 var y uint16 11217 x = 0 11218 y = 0 11219 r = x << y 11220 if r != 0 { 11221 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 11222 } 11223 y = 1 11224 r = x << y 11225 if r != 0 { 11226 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 11227 } 11228 y = 65535 11229 r = x << y 11230 if r != 0 { 11231 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 11232 } 11233 x = 1 11234 y = 0 11235 r = x << y 11236 if r != 1 { 11237 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11238 } 11239 y = 1 11240 r = x << y 11241 if r != 2 { 11242 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11243 } 11244 y = 65535 11245 r = x << y 11246 if r != 0 { 11247 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 11248 } 11249 x = 255 11250 y = 0 11251 r = x << y 11252 if r != 255 { 11253 t.Errorf("255 %s 0 = %d, want 255", "<<", r) 11254 } 11255 y = 1 11256 r = x << y 11257 if r != 254 { 11258 t.Errorf("255 %s 1 = %d, want 254", "<<", r) 11259 } 11260 y = 65535 11261 r = x << y 11262 if r != 0 { 11263 t.Errorf("255 %s 65535 = %d, want 0", "<<", r) 11264 } 11265 } 11266 func TestConstFolduint8uint16rsh(t *testing.T) { 11267 var x, r uint8 11268 var y uint16 11269 x = 0 11270 y = 0 11271 r = x >> y 11272 if r != 0 { 11273 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11274 } 11275 y = 1 11276 r = x >> y 11277 if r != 0 { 11278 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11279 } 11280 y = 65535 11281 r = x >> y 11282 if r != 0 { 11283 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 11284 } 11285 x = 1 11286 y = 0 11287 r = x >> y 11288 if r != 1 { 11289 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11290 } 11291 y = 1 11292 r = x >> y 11293 if r != 0 { 11294 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11295 } 11296 y = 65535 11297 r = x >> y 11298 if r != 0 { 11299 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 11300 } 11301 x = 255 11302 y = 0 11303 r = x >> y 11304 if r != 255 { 11305 t.Errorf("255 %s 0 = %d, want 255", ">>", r) 11306 } 11307 y = 1 11308 r = x >> y 11309 if r != 127 { 11310 t.Errorf("255 %s 1 = %d, want 127", ">>", r) 11311 } 11312 y = 65535 11313 r = x >> y 11314 if r != 0 { 11315 t.Errorf("255 %s 65535 = %d, want 0", ">>", r) 11316 } 11317 } 11318 func TestConstFolduint8uint8lsh(t *testing.T) { 11319 var x, r uint8 11320 var y uint8 11321 x = 0 11322 y = 0 11323 r = x << y 11324 if r != 0 { 11325 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 11326 } 11327 y = 1 11328 r = x << y 11329 if r != 0 { 11330 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 11331 } 11332 y = 255 11333 r = x << y 11334 if r != 0 { 11335 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 11336 } 11337 x = 1 11338 y = 0 11339 r = x << y 11340 if r != 1 { 11341 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11342 } 11343 y = 1 11344 r = x << y 11345 if r != 2 { 11346 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11347 } 11348 y = 255 11349 r = x << y 11350 if r != 0 { 11351 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 11352 } 11353 x = 255 11354 y = 0 11355 r = x << y 11356 if r != 255 { 11357 t.Errorf("255 %s 0 = %d, want 255", "<<", r) 11358 } 11359 y = 1 11360 r = x << y 11361 if r != 254 { 11362 t.Errorf("255 %s 1 = %d, want 254", "<<", r) 11363 } 11364 y = 255 11365 r = x << y 11366 if r != 0 { 11367 t.Errorf("255 %s 255 = %d, want 0", "<<", r) 11368 } 11369 } 11370 func TestConstFolduint8uint8rsh(t *testing.T) { 11371 var x, r uint8 11372 var y uint8 11373 x = 0 11374 y = 0 11375 r = x >> y 11376 if r != 0 { 11377 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11378 } 11379 y = 1 11380 r = x >> y 11381 if r != 0 { 11382 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11383 } 11384 y = 255 11385 r = x >> y 11386 if r != 0 { 11387 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 11388 } 11389 x = 1 11390 y = 0 11391 r = x >> y 11392 if r != 1 { 11393 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11394 } 11395 y = 1 11396 r = x >> y 11397 if r != 0 { 11398 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11399 } 11400 y = 255 11401 r = x >> y 11402 if r != 0 { 11403 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 11404 } 11405 x = 255 11406 y = 0 11407 r = x >> y 11408 if r != 255 { 11409 t.Errorf("255 %s 0 = %d, want 255", ">>", r) 11410 } 11411 y = 1 11412 r = x >> y 11413 if r != 127 { 11414 t.Errorf("255 %s 1 = %d, want 127", ">>", r) 11415 } 11416 y = 255 11417 r = x >> y 11418 if r != 0 { 11419 t.Errorf("255 %s 255 = %d, want 0", ">>", r) 11420 } 11421 } 11422 func TestConstFoldint8uint64lsh(t *testing.T) { 11423 var x, r int8 11424 var y uint64 11425 x = -128 11426 y = 0 11427 r = x << y 11428 if r != -128 { 11429 t.Errorf("-128 %s 0 = %d, want -128", "<<", r) 11430 } 11431 y = 1 11432 r = x << y 11433 if r != 0 { 11434 t.Errorf("-128 %s 1 = %d, want 0", "<<", r) 11435 } 11436 y = 4294967296 11437 r = x << y 11438 if r != 0 { 11439 t.Errorf("-128 %s 4294967296 = %d, want 0", "<<", r) 11440 } 11441 y = 18446744073709551615 11442 r = x << y 11443 if r != 0 { 11444 t.Errorf("-128 %s 18446744073709551615 = %d, want 0", "<<", r) 11445 } 11446 x = -127 11447 y = 0 11448 r = x << y 11449 if r != -127 { 11450 t.Errorf("-127 %s 0 = %d, want -127", "<<", r) 11451 } 11452 y = 1 11453 r = x << y 11454 if r != 2 { 11455 t.Errorf("-127 %s 1 = %d, want 2", "<<", r) 11456 } 11457 y = 4294967296 11458 r = x << y 11459 if r != 0 { 11460 t.Errorf("-127 %s 4294967296 = %d, want 0", "<<", r) 11461 } 11462 y = 18446744073709551615 11463 r = x << y 11464 if r != 0 { 11465 t.Errorf("-127 %s 18446744073709551615 = %d, want 0", "<<", r) 11466 } 11467 x = -1 11468 y = 0 11469 r = x << y 11470 if r != -1 { 11471 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 11472 } 11473 y = 1 11474 r = x << y 11475 if r != -2 { 11476 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 11477 } 11478 y = 4294967296 11479 r = x << y 11480 if r != 0 { 11481 t.Errorf("-1 %s 4294967296 = %d, want 0", "<<", r) 11482 } 11483 y = 18446744073709551615 11484 r = x << y 11485 if r != 0 { 11486 t.Errorf("-1 %s 18446744073709551615 = %d, want 0", "<<", r) 11487 } 11488 x = 0 11489 y = 0 11490 r = x << y 11491 if r != 0 { 11492 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 11493 } 11494 y = 1 11495 r = x << y 11496 if r != 0 { 11497 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 11498 } 11499 y = 4294967296 11500 r = x << y 11501 if r != 0 { 11502 t.Errorf("0 %s 4294967296 = %d, want 0", "<<", r) 11503 } 11504 y = 18446744073709551615 11505 r = x << y 11506 if r != 0 { 11507 t.Errorf("0 %s 18446744073709551615 = %d, want 0", "<<", r) 11508 } 11509 x = 1 11510 y = 0 11511 r = x << y 11512 if r != 1 { 11513 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11514 } 11515 y = 1 11516 r = x << y 11517 if r != 2 { 11518 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11519 } 11520 y = 4294967296 11521 r = x << y 11522 if r != 0 { 11523 t.Errorf("1 %s 4294967296 = %d, want 0", "<<", r) 11524 } 11525 y = 18446744073709551615 11526 r = x << y 11527 if r != 0 { 11528 t.Errorf("1 %s 18446744073709551615 = %d, want 0", "<<", r) 11529 } 11530 x = 126 11531 y = 0 11532 r = x << y 11533 if r != 126 { 11534 t.Errorf("126 %s 0 = %d, want 126", "<<", r) 11535 } 11536 y = 1 11537 r = x << y 11538 if r != -4 { 11539 t.Errorf("126 %s 1 = %d, want -4", "<<", r) 11540 } 11541 y = 4294967296 11542 r = x << y 11543 if r != 0 { 11544 t.Errorf("126 %s 4294967296 = %d, want 0", "<<", r) 11545 } 11546 y = 18446744073709551615 11547 r = x << y 11548 if r != 0 { 11549 t.Errorf("126 %s 18446744073709551615 = %d, want 0", "<<", r) 11550 } 11551 x = 127 11552 y = 0 11553 r = x << y 11554 if r != 127 { 11555 t.Errorf("127 %s 0 = %d, want 127", "<<", r) 11556 } 11557 y = 1 11558 r = x << y 11559 if r != -2 { 11560 t.Errorf("127 %s 1 = %d, want -2", "<<", r) 11561 } 11562 y = 4294967296 11563 r = x << y 11564 if r != 0 { 11565 t.Errorf("127 %s 4294967296 = %d, want 0", "<<", r) 11566 } 11567 y = 18446744073709551615 11568 r = x << y 11569 if r != 0 { 11570 t.Errorf("127 %s 18446744073709551615 = %d, want 0", "<<", r) 11571 } 11572 } 11573 func TestConstFoldint8uint64rsh(t *testing.T) { 11574 var x, r int8 11575 var y uint64 11576 x = -128 11577 y = 0 11578 r = x >> y 11579 if r != -128 { 11580 t.Errorf("-128 %s 0 = %d, want -128", ">>", r) 11581 } 11582 y = 1 11583 r = x >> y 11584 if r != -64 { 11585 t.Errorf("-128 %s 1 = %d, want -64", ">>", r) 11586 } 11587 y = 4294967296 11588 r = x >> y 11589 if r != -1 { 11590 t.Errorf("-128 %s 4294967296 = %d, want -1", ">>", r) 11591 } 11592 y = 18446744073709551615 11593 r = x >> y 11594 if r != -1 { 11595 t.Errorf("-128 %s 18446744073709551615 = %d, want -1", ">>", r) 11596 } 11597 x = -127 11598 y = 0 11599 r = x >> y 11600 if r != -127 { 11601 t.Errorf("-127 %s 0 = %d, want -127", ">>", r) 11602 } 11603 y = 1 11604 r = x >> y 11605 if r != -64 { 11606 t.Errorf("-127 %s 1 = %d, want -64", ">>", r) 11607 } 11608 y = 4294967296 11609 r = x >> y 11610 if r != -1 { 11611 t.Errorf("-127 %s 4294967296 = %d, want -1", ">>", r) 11612 } 11613 y = 18446744073709551615 11614 r = x >> y 11615 if r != -1 { 11616 t.Errorf("-127 %s 18446744073709551615 = %d, want -1", ">>", r) 11617 } 11618 x = -1 11619 y = 0 11620 r = x >> y 11621 if r != -1 { 11622 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 11623 } 11624 y = 1 11625 r = x >> y 11626 if r != -1 { 11627 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 11628 } 11629 y = 4294967296 11630 r = x >> y 11631 if r != -1 { 11632 t.Errorf("-1 %s 4294967296 = %d, want -1", ">>", r) 11633 } 11634 y = 18446744073709551615 11635 r = x >> y 11636 if r != -1 { 11637 t.Errorf("-1 %s 18446744073709551615 = %d, want -1", ">>", r) 11638 } 11639 x = 0 11640 y = 0 11641 r = x >> y 11642 if r != 0 { 11643 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11644 } 11645 y = 1 11646 r = x >> y 11647 if r != 0 { 11648 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11649 } 11650 y = 4294967296 11651 r = x >> y 11652 if r != 0 { 11653 t.Errorf("0 %s 4294967296 = %d, want 0", ">>", r) 11654 } 11655 y = 18446744073709551615 11656 r = x >> y 11657 if r != 0 { 11658 t.Errorf("0 %s 18446744073709551615 = %d, want 0", ">>", r) 11659 } 11660 x = 1 11661 y = 0 11662 r = x >> y 11663 if r != 1 { 11664 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11665 } 11666 y = 1 11667 r = x >> y 11668 if r != 0 { 11669 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11670 } 11671 y = 4294967296 11672 r = x >> y 11673 if r != 0 { 11674 t.Errorf("1 %s 4294967296 = %d, want 0", ">>", r) 11675 } 11676 y = 18446744073709551615 11677 r = x >> y 11678 if r != 0 { 11679 t.Errorf("1 %s 18446744073709551615 = %d, want 0", ">>", r) 11680 } 11681 x = 126 11682 y = 0 11683 r = x >> y 11684 if r != 126 { 11685 t.Errorf("126 %s 0 = %d, want 126", ">>", r) 11686 } 11687 y = 1 11688 r = x >> y 11689 if r != 63 { 11690 t.Errorf("126 %s 1 = %d, want 63", ">>", r) 11691 } 11692 y = 4294967296 11693 r = x >> y 11694 if r != 0 { 11695 t.Errorf("126 %s 4294967296 = %d, want 0", ">>", r) 11696 } 11697 y = 18446744073709551615 11698 r = x >> y 11699 if r != 0 { 11700 t.Errorf("126 %s 18446744073709551615 = %d, want 0", ">>", r) 11701 } 11702 x = 127 11703 y = 0 11704 r = x >> y 11705 if r != 127 { 11706 t.Errorf("127 %s 0 = %d, want 127", ">>", r) 11707 } 11708 y = 1 11709 r = x >> y 11710 if r != 63 { 11711 t.Errorf("127 %s 1 = %d, want 63", ">>", r) 11712 } 11713 y = 4294967296 11714 r = x >> y 11715 if r != 0 { 11716 t.Errorf("127 %s 4294967296 = %d, want 0", ">>", r) 11717 } 11718 y = 18446744073709551615 11719 r = x >> y 11720 if r != 0 { 11721 t.Errorf("127 %s 18446744073709551615 = %d, want 0", ">>", r) 11722 } 11723 } 11724 func TestConstFoldint8uint32lsh(t *testing.T) { 11725 var x, r int8 11726 var y uint32 11727 x = -128 11728 y = 0 11729 r = x << y 11730 if r != -128 { 11731 t.Errorf("-128 %s 0 = %d, want -128", "<<", r) 11732 } 11733 y = 1 11734 r = x << y 11735 if r != 0 { 11736 t.Errorf("-128 %s 1 = %d, want 0", "<<", r) 11737 } 11738 y = 4294967295 11739 r = x << y 11740 if r != 0 { 11741 t.Errorf("-128 %s 4294967295 = %d, want 0", "<<", r) 11742 } 11743 x = -127 11744 y = 0 11745 r = x << y 11746 if r != -127 { 11747 t.Errorf("-127 %s 0 = %d, want -127", "<<", r) 11748 } 11749 y = 1 11750 r = x << y 11751 if r != 2 { 11752 t.Errorf("-127 %s 1 = %d, want 2", "<<", r) 11753 } 11754 y = 4294967295 11755 r = x << y 11756 if r != 0 { 11757 t.Errorf("-127 %s 4294967295 = %d, want 0", "<<", r) 11758 } 11759 x = -1 11760 y = 0 11761 r = x << y 11762 if r != -1 { 11763 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 11764 } 11765 y = 1 11766 r = x << y 11767 if r != -2 { 11768 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 11769 } 11770 y = 4294967295 11771 r = x << y 11772 if r != 0 { 11773 t.Errorf("-1 %s 4294967295 = %d, want 0", "<<", r) 11774 } 11775 x = 0 11776 y = 0 11777 r = x << y 11778 if r != 0 { 11779 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 11780 } 11781 y = 1 11782 r = x << y 11783 if r != 0 { 11784 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 11785 } 11786 y = 4294967295 11787 r = x << y 11788 if r != 0 { 11789 t.Errorf("0 %s 4294967295 = %d, want 0", "<<", r) 11790 } 11791 x = 1 11792 y = 0 11793 r = x << y 11794 if r != 1 { 11795 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 11796 } 11797 y = 1 11798 r = x << y 11799 if r != 2 { 11800 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 11801 } 11802 y = 4294967295 11803 r = x << y 11804 if r != 0 { 11805 t.Errorf("1 %s 4294967295 = %d, want 0", "<<", r) 11806 } 11807 x = 126 11808 y = 0 11809 r = x << y 11810 if r != 126 { 11811 t.Errorf("126 %s 0 = %d, want 126", "<<", r) 11812 } 11813 y = 1 11814 r = x << y 11815 if r != -4 { 11816 t.Errorf("126 %s 1 = %d, want -4", "<<", r) 11817 } 11818 y = 4294967295 11819 r = x << y 11820 if r != 0 { 11821 t.Errorf("126 %s 4294967295 = %d, want 0", "<<", r) 11822 } 11823 x = 127 11824 y = 0 11825 r = x << y 11826 if r != 127 { 11827 t.Errorf("127 %s 0 = %d, want 127", "<<", r) 11828 } 11829 y = 1 11830 r = x << y 11831 if r != -2 { 11832 t.Errorf("127 %s 1 = %d, want -2", "<<", r) 11833 } 11834 y = 4294967295 11835 r = x << y 11836 if r != 0 { 11837 t.Errorf("127 %s 4294967295 = %d, want 0", "<<", r) 11838 } 11839 } 11840 func TestConstFoldint8uint32rsh(t *testing.T) { 11841 var x, r int8 11842 var y uint32 11843 x = -128 11844 y = 0 11845 r = x >> y 11846 if r != -128 { 11847 t.Errorf("-128 %s 0 = %d, want -128", ">>", r) 11848 } 11849 y = 1 11850 r = x >> y 11851 if r != -64 { 11852 t.Errorf("-128 %s 1 = %d, want -64", ">>", r) 11853 } 11854 y = 4294967295 11855 r = x >> y 11856 if r != -1 { 11857 t.Errorf("-128 %s 4294967295 = %d, want -1", ">>", r) 11858 } 11859 x = -127 11860 y = 0 11861 r = x >> y 11862 if r != -127 { 11863 t.Errorf("-127 %s 0 = %d, want -127", ">>", r) 11864 } 11865 y = 1 11866 r = x >> y 11867 if r != -64 { 11868 t.Errorf("-127 %s 1 = %d, want -64", ">>", r) 11869 } 11870 y = 4294967295 11871 r = x >> y 11872 if r != -1 { 11873 t.Errorf("-127 %s 4294967295 = %d, want -1", ">>", r) 11874 } 11875 x = -1 11876 y = 0 11877 r = x >> y 11878 if r != -1 { 11879 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 11880 } 11881 y = 1 11882 r = x >> y 11883 if r != -1 { 11884 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 11885 } 11886 y = 4294967295 11887 r = x >> y 11888 if r != -1 { 11889 t.Errorf("-1 %s 4294967295 = %d, want -1", ">>", r) 11890 } 11891 x = 0 11892 y = 0 11893 r = x >> y 11894 if r != 0 { 11895 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 11896 } 11897 y = 1 11898 r = x >> y 11899 if r != 0 { 11900 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 11901 } 11902 y = 4294967295 11903 r = x >> y 11904 if r != 0 { 11905 t.Errorf("0 %s 4294967295 = %d, want 0", ">>", r) 11906 } 11907 x = 1 11908 y = 0 11909 r = x >> y 11910 if r != 1 { 11911 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 11912 } 11913 y = 1 11914 r = x >> y 11915 if r != 0 { 11916 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 11917 } 11918 y = 4294967295 11919 r = x >> y 11920 if r != 0 { 11921 t.Errorf("1 %s 4294967295 = %d, want 0", ">>", r) 11922 } 11923 x = 126 11924 y = 0 11925 r = x >> y 11926 if r != 126 { 11927 t.Errorf("126 %s 0 = %d, want 126", ">>", r) 11928 } 11929 y = 1 11930 r = x >> y 11931 if r != 63 { 11932 t.Errorf("126 %s 1 = %d, want 63", ">>", r) 11933 } 11934 y = 4294967295 11935 r = x >> y 11936 if r != 0 { 11937 t.Errorf("126 %s 4294967295 = %d, want 0", ">>", r) 11938 } 11939 x = 127 11940 y = 0 11941 r = x >> y 11942 if r != 127 { 11943 t.Errorf("127 %s 0 = %d, want 127", ">>", r) 11944 } 11945 y = 1 11946 r = x >> y 11947 if r != 63 { 11948 t.Errorf("127 %s 1 = %d, want 63", ">>", r) 11949 } 11950 y = 4294967295 11951 r = x >> y 11952 if r != 0 { 11953 t.Errorf("127 %s 4294967295 = %d, want 0", ">>", r) 11954 } 11955 } 11956 func TestConstFoldint8uint16lsh(t *testing.T) { 11957 var x, r int8 11958 var y uint16 11959 x = -128 11960 y = 0 11961 r = x << y 11962 if r != -128 { 11963 t.Errorf("-128 %s 0 = %d, want -128", "<<", r) 11964 } 11965 y = 1 11966 r = x << y 11967 if r != 0 { 11968 t.Errorf("-128 %s 1 = %d, want 0", "<<", r) 11969 } 11970 y = 65535 11971 r = x << y 11972 if r != 0 { 11973 t.Errorf("-128 %s 65535 = %d, want 0", "<<", r) 11974 } 11975 x = -127 11976 y = 0 11977 r = x << y 11978 if r != -127 { 11979 t.Errorf("-127 %s 0 = %d, want -127", "<<", r) 11980 } 11981 y = 1 11982 r = x << y 11983 if r != 2 { 11984 t.Errorf("-127 %s 1 = %d, want 2", "<<", r) 11985 } 11986 y = 65535 11987 r = x << y 11988 if r != 0 { 11989 t.Errorf("-127 %s 65535 = %d, want 0", "<<", r) 11990 } 11991 x = -1 11992 y = 0 11993 r = x << y 11994 if r != -1 { 11995 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 11996 } 11997 y = 1 11998 r = x << y 11999 if r != -2 { 12000 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 12001 } 12002 y = 65535 12003 r = x << y 12004 if r != 0 { 12005 t.Errorf("-1 %s 65535 = %d, want 0", "<<", r) 12006 } 12007 x = 0 12008 y = 0 12009 r = x << y 12010 if r != 0 { 12011 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 12012 } 12013 y = 1 12014 r = x << y 12015 if r != 0 { 12016 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 12017 } 12018 y = 65535 12019 r = x << y 12020 if r != 0 { 12021 t.Errorf("0 %s 65535 = %d, want 0", "<<", r) 12022 } 12023 x = 1 12024 y = 0 12025 r = x << y 12026 if r != 1 { 12027 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 12028 } 12029 y = 1 12030 r = x << y 12031 if r != 2 { 12032 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 12033 } 12034 y = 65535 12035 r = x << y 12036 if r != 0 { 12037 t.Errorf("1 %s 65535 = %d, want 0", "<<", r) 12038 } 12039 x = 126 12040 y = 0 12041 r = x << y 12042 if r != 126 { 12043 t.Errorf("126 %s 0 = %d, want 126", "<<", r) 12044 } 12045 y = 1 12046 r = x << y 12047 if r != -4 { 12048 t.Errorf("126 %s 1 = %d, want -4", "<<", r) 12049 } 12050 y = 65535 12051 r = x << y 12052 if r != 0 { 12053 t.Errorf("126 %s 65535 = %d, want 0", "<<", r) 12054 } 12055 x = 127 12056 y = 0 12057 r = x << y 12058 if r != 127 { 12059 t.Errorf("127 %s 0 = %d, want 127", "<<", r) 12060 } 12061 y = 1 12062 r = x << y 12063 if r != -2 { 12064 t.Errorf("127 %s 1 = %d, want -2", "<<", r) 12065 } 12066 y = 65535 12067 r = x << y 12068 if r != 0 { 12069 t.Errorf("127 %s 65535 = %d, want 0", "<<", r) 12070 } 12071 } 12072 func TestConstFoldint8uint16rsh(t *testing.T) { 12073 var x, r int8 12074 var y uint16 12075 x = -128 12076 y = 0 12077 r = x >> y 12078 if r != -128 { 12079 t.Errorf("-128 %s 0 = %d, want -128", ">>", r) 12080 } 12081 y = 1 12082 r = x >> y 12083 if r != -64 { 12084 t.Errorf("-128 %s 1 = %d, want -64", ">>", r) 12085 } 12086 y = 65535 12087 r = x >> y 12088 if r != -1 { 12089 t.Errorf("-128 %s 65535 = %d, want -1", ">>", r) 12090 } 12091 x = -127 12092 y = 0 12093 r = x >> y 12094 if r != -127 { 12095 t.Errorf("-127 %s 0 = %d, want -127", ">>", r) 12096 } 12097 y = 1 12098 r = x >> y 12099 if r != -64 { 12100 t.Errorf("-127 %s 1 = %d, want -64", ">>", r) 12101 } 12102 y = 65535 12103 r = x >> y 12104 if r != -1 { 12105 t.Errorf("-127 %s 65535 = %d, want -1", ">>", r) 12106 } 12107 x = -1 12108 y = 0 12109 r = x >> y 12110 if r != -1 { 12111 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 12112 } 12113 y = 1 12114 r = x >> y 12115 if r != -1 { 12116 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 12117 } 12118 y = 65535 12119 r = x >> y 12120 if r != -1 { 12121 t.Errorf("-1 %s 65535 = %d, want -1", ">>", r) 12122 } 12123 x = 0 12124 y = 0 12125 r = x >> y 12126 if r != 0 { 12127 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 12128 } 12129 y = 1 12130 r = x >> y 12131 if r != 0 { 12132 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 12133 } 12134 y = 65535 12135 r = x >> y 12136 if r != 0 { 12137 t.Errorf("0 %s 65535 = %d, want 0", ">>", r) 12138 } 12139 x = 1 12140 y = 0 12141 r = x >> y 12142 if r != 1 { 12143 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 12144 } 12145 y = 1 12146 r = x >> y 12147 if r != 0 { 12148 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 12149 } 12150 y = 65535 12151 r = x >> y 12152 if r != 0 { 12153 t.Errorf("1 %s 65535 = %d, want 0", ">>", r) 12154 } 12155 x = 126 12156 y = 0 12157 r = x >> y 12158 if r != 126 { 12159 t.Errorf("126 %s 0 = %d, want 126", ">>", r) 12160 } 12161 y = 1 12162 r = x >> y 12163 if r != 63 { 12164 t.Errorf("126 %s 1 = %d, want 63", ">>", r) 12165 } 12166 y = 65535 12167 r = x >> y 12168 if r != 0 { 12169 t.Errorf("126 %s 65535 = %d, want 0", ">>", r) 12170 } 12171 x = 127 12172 y = 0 12173 r = x >> y 12174 if r != 127 { 12175 t.Errorf("127 %s 0 = %d, want 127", ">>", r) 12176 } 12177 y = 1 12178 r = x >> y 12179 if r != 63 { 12180 t.Errorf("127 %s 1 = %d, want 63", ">>", r) 12181 } 12182 y = 65535 12183 r = x >> y 12184 if r != 0 { 12185 t.Errorf("127 %s 65535 = %d, want 0", ">>", r) 12186 } 12187 } 12188 func TestConstFoldint8uint8lsh(t *testing.T) { 12189 var x, r int8 12190 var y uint8 12191 x = -128 12192 y = 0 12193 r = x << y 12194 if r != -128 { 12195 t.Errorf("-128 %s 0 = %d, want -128", "<<", r) 12196 } 12197 y = 1 12198 r = x << y 12199 if r != 0 { 12200 t.Errorf("-128 %s 1 = %d, want 0", "<<", r) 12201 } 12202 y = 255 12203 r = x << y 12204 if r != 0 { 12205 t.Errorf("-128 %s 255 = %d, want 0", "<<", r) 12206 } 12207 x = -127 12208 y = 0 12209 r = x << y 12210 if r != -127 { 12211 t.Errorf("-127 %s 0 = %d, want -127", "<<", r) 12212 } 12213 y = 1 12214 r = x << y 12215 if r != 2 { 12216 t.Errorf("-127 %s 1 = %d, want 2", "<<", r) 12217 } 12218 y = 255 12219 r = x << y 12220 if r != 0 { 12221 t.Errorf("-127 %s 255 = %d, want 0", "<<", r) 12222 } 12223 x = -1 12224 y = 0 12225 r = x << y 12226 if r != -1 { 12227 t.Errorf("-1 %s 0 = %d, want -1", "<<", r) 12228 } 12229 y = 1 12230 r = x << y 12231 if r != -2 { 12232 t.Errorf("-1 %s 1 = %d, want -2", "<<", r) 12233 } 12234 y = 255 12235 r = x << y 12236 if r != 0 { 12237 t.Errorf("-1 %s 255 = %d, want 0", "<<", r) 12238 } 12239 x = 0 12240 y = 0 12241 r = x << y 12242 if r != 0 { 12243 t.Errorf("0 %s 0 = %d, want 0", "<<", r) 12244 } 12245 y = 1 12246 r = x << y 12247 if r != 0 { 12248 t.Errorf("0 %s 1 = %d, want 0", "<<", r) 12249 } 12250 y = 255 12251 r = x << y 12252 if r != 0 { 12253 t.Errorf("0 %s 255 = %d, want 0", "<<", r) 12254 } 12255 x = 1 12256 y = 0 12257 r = x << y 12258 if r != 1 { 12259 t.Errorf("1 %s 0 = %d, want 1", "<<", r) 12260 } 12261 y = 1 12262 r = x << y 12263 if r != 2 { 12264 t.Errorf("1 %s 1 = %d, want 2", "<<", r) 12265 } 12266 y = 255 12267 r = x << y 12268 if r != 0 { 12269 t.Errorf("1 %s 255 = %d, want 0", "<<", r) 12270 } 12271 x = 126 12272 y = 0 12273 r = x << y 12274 if r != 126 { 12275 t.Errorf("126 %s 0 = %d, want 126", "<<", r) 12276 } 12277 y = 1 12278 r = x << y 12279 if r != -4 { 12280 t.Errorf("126 %s 1 = %d, want -4", "<<", r) 12281 } 12282 y = 255 12283 r = x << y 12284 if r != 0 { 12285 t.Errorf("126 %s 255 = %d, want 0", "<<", r) 12286 } 12287 x = 127 12288 y = 0 12289 r = x << y 12290 if r != 127 { 12291 t.Errorf("127 %s 0 = %d, want 127", "<<", r) 12292 } 12293 y = 1 12294 r = x << y 12295 if r != -2 { 12296 t.Errorf("127 %s 1 = %d, want -2", "<<", r) 12297 } 12298 y = 255 12299 r = x << y 12300 if r != 0 { 12301 t.Errorf("127 %s 255 = %d, want 0", "<<", r) 12302 } 12303 } 12304 func TestConstFoldint8uint8rsh(t *testing.T) { 12305 var x, r int8 12306 var y uint8 12307 x = -128 12308 y = 0 12309 r = x >> y 12310 if r != -128 { 12311 t.Errorf("-128 %s 0 = %d, want -128", ">>", r) 12312 } 12313 y = 1 12314 r = x >> y 12315 if r != -64 { 12316 t.Errorf("-128 %s 1 = %d, want -64", ">>", r) 12317 } 12318 y = 255 12319 r = x >> y 12320 if r != -1 { 12321 t.Errorf("-128 %s 255 = %d, want -1", ">>", r) 12322 } 12323 x = -127 12324 y = 0 12325 r = x >> y 12326 if r != -127 { 12327 t.Errorf("-127 %s 0 = %d, want -127", ">>", r) 12328 } 12329 y = 1 12330 r = x >> y 12331 if r != -64 { 12332 t.Errorf("-127 %s 1 = %d, want -64", ">>", r) 12333 } 12334 y = 255 12335 r = x >> y 12336 if r != -1 { 12337 t.Errorf("-127 %s 255 = %d, want -1", ">>", r) 12338 } 12339 x = -1 12340 y = 0 12341 r = x >> y 12342 if r != -1 { 12343 t.Errorf("-1 %s 0 = %d, want -1", ">>", r) 12344 } 12345 y = 1 12346 r = x >> y 12347 if r != -1 { 12348 t.Errorf("-1 %s 1 = %d, want -1", ">>", r) 12349 } 12350 y = 255 12351 r = x >> y 12352 if r != -1 { 12353 t.Errorf("-1 %s 255 = %d, want -1", ">>", r) 12354 } 12355 x = 0 12356 y = 0 12357 r = x >> y 12358 if r != 0 { 12359 t.Errorf("0 %s 0 = %d, want 0", ">>", r) 12360 } 12361 y = 1 12362 r = x >> y 12363 if r != 0 { 12364 t.Errorf("0 %s 1 = %d, want 0", ">>", r) 12365 } 12366 y = 255 12367 r = x >> y 12368 if r != 0 { 12369 t.Errorf("0 %s 255 = %d, want 0", ">>", r) 12370 } 12371 x = 1 12372 y = 0 12373 r = x >> y 12374 if r != 1 { 12375 t.Errorf("1 %s 0 = %d, want 1", ">>", r) 12376 } 12377 y = 1 12378 r = x >> y 12379 if r != 0 { 12380 t.Errorf("1 %s 1 = %d, want 0", ">>", r) 12381 } 12382 y = 255 12383 r = x >> y 12384 if r != 0 { 12385 t.Errorf("1 %s 255 = %d, want 0", ">>", r) 12386 } 12387 x = 126 12388 y = 0 12389 r = x >> y 12390 if r != 126 { 12391 t.Errorf("126 %s 0 = %d, want 126", ">>", r) 12392 } 12393 y = 1 12394 r = x >> y 12395 if r != 63 { 12396 t.Errorf("126 %s 1 = %d, want 63", ">>", r) 12397 } 12398 y = 255 12399 r = x >> y 12400 if r != 0 { 12401 t.Errorf("126 %s 255 = %d, want 0", ">>", r) 12402 } 12403 x = 127 12404 y = 0 12405 r = x >> y 12406 if r != 127 { 12407 t.Errorf("127 %s 0 = %d, want 127", ">>", r) 12408 } 12409 y = 1 12410 r = x >> y 12411 if r != 63 { 12412 t.Errorf("127 %s 1 = %d, want 63", ">>", r) 12413 } 12414 y = 255 12415 r = x >> y 12416 if r != 0 { 12417 t.Errorf("127 %s 255 = %d, want 0", ">>", r) 12418 } 12419 } 12420 func TestConstFoldCompareuint64(t *testing.T) { 12421 { 12422 var x uint64 = 0 12423 var y uint64 = 0 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 if !(x >= y) { 12440 t.Errorf("!(%d >= %d)", x, y) 12441 } 12442 } 12443 { 12444 var x uint64 = 0 12445 var y uint64 = 1 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 if x >= y { 12462 t.Errorf("%d >= %d", x, y) 12463 } 12464 } 12465 { 12466 var x uint64 = 0 12467 var y uint64 = 4294967296 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 if x >= y { 12484 t.Errorf("%d >= %d", x, y) 12485 } 12486 } 12487 { 12488 var x uint64 = 0 12489 var y uint64 = 18446744073709551615 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 if x >= y { 12506 t.Errorf("%d >= %d", x, y) 12507 } 12508 } 12509 { 12510 var x uint64 = 1 12511 var y uint64 = 0 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 if !(x >= y) { 12528 t.Errorf("!(%d >= %d)", x, y) 12529 } 12530 } 12531 { 12532 var x uint64 = 1 12533 var y uint64 = 1 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 if !(x >= y) { 12550 t.Errorf("!(%d >= %d)", x, y) 12551 } 12552 } 12553 { 12554 var x uint64 = 1 12555 var y uint64 = 4294967296 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 if x >= y { 12572 t.Errorf("%d >= %d", x, y) 12573 } 12574 } 12575 { 12576 var x uint64 = 1 12577 var y uint64 = 18446744073709551615 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 if x >= y { 12594 t.Errorf("%d >= %d", x, y) 12595 } 12596 } 12597 { 12598 var x uint64 = 4294967296 12599 var y uint64 = 0 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 if !(x >= y) { 12616 t.Errorf("!(%d >= %d)", x, y) 12617 } 12618 } 12619 { 12620 var x uint64 = 4294967296 12621 var y uint64 = 1 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 if !(x >= y) { 12638 t.Errorf("!(%d >= %d)", x, y) 12639 } 12640 } 12641 { 12642 var x uint64 = 4294967296 12643 var y uint64 = 4294967296 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 if !(x >= y) { 12660 t.Errorf("!(%d >= %d)", x, y) 12661 } 12662 } 12663 { 12664 var x uint64 = 4294967296 12665 var y uint64 = 18446744073709551615 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 if x >= y { 12682 t.Errorf("%d >= %d", x, y) 12683 } 12684 } 12685 { 12686 var x uint64 = 18446744073709551615 12687 var y uint64 = 0 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 if !(x >= y) { 12704 t.Errorf("!(%d >= %d)", x, y) 12705 } 12706 } 12707 { 12708 var x uint64 = 18446744073709551615 12709 var y uint64 = 1 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 if !(x >= y) { 12726 t.Errorf("!(%d >= %d)", x, y) 12727 } 12728 } 12729 { 12730 var x uint64 = 18446744073709551615 12731 var y uint64 = 4294967296 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 if !(x >= y) { 12748 t.Errorf("!(%d >= %d)", x, y) 12749 } 12750 } 12751 { 12752 var x uint64 = 18446744073709551615 12753 var y uint64 = 18446744073709551615 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 if !(x >= y) { 12770 t.Errorf("!(%d >= %d)", x, y) 12771 } 12772 } 12773 } 12774 func TestConstFoldCompareint64(t *testing.T) { 12775 { 12776 var x int64 = -9223372036854775808 12777 var y int64 = -9223372036854775808 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 if !(x >= y) { 12794 t.Errorf("!(%d >= %d)", x, y) 12795 } 12796 } 12797 { 12798 var x int64 = -9223372036854775808 12799 var y int64 = -9223372036854775807 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 if x >= y { 12816 t.Errorf("%d >= %d", x, y) 12817 } 12818 } 12819 { 12820 var x int64 = -9223372036854775808 12821 var y int64 = -4294967296 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 if x >= y { 12838 t.Errorf("%d >= %d", x, y) 12839 } 12840 } 12841 { 12842 var x int64 = -9223372036854775808 12843 var y int64 = -1 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 if x >= y { 12860 t.Errorf("%d >= %d", x, y) 12861 } 12862 } 12863 { 12864 var x int64 = -9223372036854775808 12865 var y int64 = 0 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 if x >= y { 12882 t.Errorf("%d >= %d", x, y) 12883 } 12884 } 12885 { 12886 var x int64 = -9223372036854775808 12887 var y int64 = 1 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 if x >= y { 12904 t.Errorf("%d >= %d", x, y) 12905 } 12906 } 12907 { 12908 var x int64 = -9223372036854775808 12909 var y int64 = 4294967296 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 if x >= y { 12926 t.Errorf("%d >= %d", x, y) 12927 } 12928 } 12929 { 12930 var x int64 = -9223372036854775808 12931 var y int64 = 9223372036854775806 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 if x >= y { 12948 t.Errorf("%d >= %d", x, y) 12949 } 12950 } 12951 { 12952 var x int64 = -9223372036854775808 12953 var y int64 = 9223372036854775807 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 if x >= y { 12970 t.Errorf("%d >= %d", x, y) 12971 } 12972 } 12973 { 12974 var x int64 = -9223372036854775807 12975 var y int64 = -9223372036854775808 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 if !(x >= y) { 12992 t.Errorf("!(%d >= %d)", x, y) 12993 } 12994 } 12995 { 12996 var x int64 = -9223372036854775807 12997 var y int64 = -9223372036854775807 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 if !(x >= y) { 13014 t.Errorf("!(%d >= %d)", x, y) 13015 } 13016 } 13017 { 13018 var x int64 = -9223372036854775807 13019 var y int64 = -4294967296 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 if x >= y { 13036 t.Errorf("%d >= %d", x, y) 13037 } 13038 } 13039 { 13040 var x int64 = -9223372036854775807 13041 var y int64 = -1 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 if x >= y { 13058 t.Errorf("%d >= %d", x, y) 13059 } 13060 } 13061 { 13062 var x int64 = -9223372036854775807 13063 var y int64 = 0 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 if x >= y { 13080 t.Errorf("%d >= %d", x, y) 13081 } 13082 } 13083 { 13084 var x int64 = -9223372036854775807 13085 var y int64 = 1 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 if x >= y { 13102 t.Errorf("%d >= %d", x, y) 13103 } 13104 } 13105 { 13106 var x int64 = -9223372036854775807 13107 var y int64 = 4294967296 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 if x >= y { 13124 t.Errorf("%d >= %d", x, y) 13125 } 13126 } 13127 { 13128 var x int64 = -9223372036854775807 13129 var y int64 = 9223372036854775806 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 if x >= y { 13146 t.Errorf("%d >= %d", x, y) 13147 } 13148 } 13149 { 13150 var x int64 = -9223372036854775807 13151 var y int64 = 9223372036854775807 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 if x >= y { 13168 t.Errorf("%d >= %d", x, y) 13169 } 13170 } 13171 { 13172 var x int64 = -4294967296 13173 var y int64 = -9223372036854775808 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 if !(x >= y) { 13190 t.Errorf("!(%d >= %d)", x, y) 13191 } 13192 } 13193 { 13194 var x int64 = -4294967296 13195 var y int64 = -9223372036854775807 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 if !(x >= y) { 13212 t.Errorf("!(%d >= %d)", x, y) 13213 } 13214 } 13215 { 13216 var x int64 = -4294967296 13217 var y int64 = -4294967296 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 if !(x >= y) { 13234 t.Errorf("!(%d >= %d)", x, y) 13235 } 13236 } 13237 { 13238 var x int64 = -4294967296 13239 var y int64 = -1 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 if x >= y { 13256 t.Errorf("%d >= %d", x, y) 13257 } 13258 } 13259 { 13260 var x int64 = -4294967296 13261 var y int64 = 0 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 if x >= y { 13278 t.Errorf("%d >= %d", x, y) 13279 } 13280 } 13281 { 13282 var x int64 = -4294967296 13283 var y int64 = 1 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 if x >= y { 13300 t.Errorf("%d >= %d", x, y) 13301 } 13302 } 13303 { 13304 var x int64 = -4294967296 13305 var y int64 = 4294967296 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 if x >= y { 13322 t.Errorf("%d >= %d", x, y) 13323 } 13324 } 13325 { 13326 var x int64 = -4294967296 13327 var y int64 = 9223372036854775806 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 if x >= y { 13344 t.Errorf("%d >= %d", x, y) 13345 } 13346 } 13347 { 13348 var x int64 = -4294967296 13349 var y int64 = 9223372036854775807 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 if x >= y { 13366 t.Errorf("%d >= %d", x, y) 13367 } 13368 } 13369 { 13370 var x int64 = -1 13371 var y int64 = -9223372036854775808 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 if !(x >= y) { 13388 t.Errorf("!(%d >= %d)", x, y) 13389 } 13390 } 13391 { 13392 var x int64 = -1 13393 var y int64 = -9223372036854775807 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 if !(x >= y) { 13410 t.Errorf("!(%d >= %d)", x, y) 13411 } 13412 } 13413 { 13414 var x int64 = -1 13415 var y int64 = -4294967296 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 if !(x >= y) { 13432 t.Errorf("!(%d >= %d)", x, y) 13433 } 13434 } 13435 { 13436 var x int64 = -1 13437 var y int64 = -1 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 if !(x >= y) { 13454 t.Errorf("!(%d >= %d)", x, y) 13455 } 13456 } 13457 { 13458 var x int64 = -1 13459 var y int64 = 0 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 if x >= y { 13476 t.Errorf("%d >= %d", x, y) 13477 } 13478 } 13479 { 13480 var x int64 = -1 13481 var y int64 = 1 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 if x >= y { 13498 t.Errorf("%d >= %d", x, y) 13499 } 13500 } 13501 { 13502 var x int64 = -1 13503 var y int64 = 4294967296 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 if x >= y { 13520 t.Errorf("%d >= %d", x, y) 13521 } 13522 } 13523 { 13524 var x int64 = -1 13525 var y int64 = 9223372036854775806 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 if x >= y { 13542 t.Errorf("%d >= %d", x, y) 13543 } 13544 } 13545 { 13546 var x int64 = -1 13547 var y int64 = 9223372036854775807 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 if x >= y { 13564 t.Errorf("%d >= %d", x, y) 13565 } 13566 } 13567 { 13568 var x int64 = 0 13569 var y int64 = -9223372036854775808 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 if !(x >= y) { 13586 t.Errorf("!(%d >= %d)", x, y) 13587 } 13588 } 13589 { 13590 var x int64 = 0 13591 var y int64 = -9223372036854775807 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 if !(x >= y) { 13608 t.Errorf("!(%d >= %d)", x, y) 13609 } 13610 } 13611 { 13612 var x int64 = 0 13613 var y int64 = -4294967296 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 if !(x >= y) { 13630 t.Errorf("!(%d >= %d)", x, y) 13631 } 13632 } 13633 { 13634 var x int64 = 0 13635 var y int64 = -1 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 if !(x >= y) { 13652 t.Errorf("!(%d >= %d)", x, y) 13653 } 13654 } 13655 { 13656 var x int64 = 0 13657 var y int64 = 0 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 if !(x >= y) { 13674 t.Errorf("!(%d >= %d)", x, y) 13675 } 13676 } 13677 { 13678 var x int64 = 0 13679 var y int64 = 1 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 if x >= y { 13696 t.Errorf("%d >= %d", x, y) 13697 } 13698 } 13699 { 13700 var x int64 = 0 13701 var y int64 = 4294967296 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 if x >= y { 13718 t.Errorf("%d >= %d", x, y) 13719 } 13720 } 13721 { 13722 var x int64 = 0 13723 var y int64 = 9223372036854775806 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 if x >= y { 13740 t.Errorf("%d >= %d", x, y) 13741 } 13742 } 13743 { 13744 var x int64 = 0 13745 var y int64 = 9223372036854775807 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 if x >= y { 13762 t.Errorf("%d >= %d", x, y) 13763 } 13764 } 13765 { 13766 var x int64 = 1 13767 var y int64 = -9223372036854775808 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 if !(x >= y) { 13784 t.Errorf("!(%d >= %d)", x, y) 13785 } 13786 } 13787 { 13788 var x int64 = 1 13789 var y int64 = -9223372036854775807 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 if !(x >= y) { 13806 t.Errorf("!(%d >= %d)", x, y) 13807 } 13808 } 13809 { 13810 var x int64 = 1 13811 var y int64 = -4294967296 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 if !(x >= y) { 13828 t.Errorf("!(%d >= %d)", x, y) 13829 } 13830 } 13831 { 13832 var x int64 = 1 13833 var y int64 = -1 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 if !(x >= y) { 13850 t.Errorf("!(%d >= %d)", x, y) 13851 } 13852 } 13853 { 13854 var x int64 = 1 13855 var y int64 = 0 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 if !(x >= y) { 13872 t.Errorf("!(%d >= %d)", x, y) 13873 } 13874 } 13875 { 13876 var x int64 = 1 13877 var y int64 = 1 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 if !(x >= y) { 13894 t.Errorf("!(%d >= %d)", x, y) 13895 } 13896 } 13897 { 13898 var x int64 = 1 13899 var y int64 = 4294967296 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 if x >= y { 13916 t.Errorf("%d >= %d", x, y) 13917 } 13918 } 13919 { 13920 var x int64 = 1 13921 var y int64 = 9223372036854775806 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 if x >= y { 13938 t.Errorf("%d >= %d", x, y) 13939 } 13940 } 13941 { 13942 var x int64 = 1 13943 var y int64 = 9223372036854775807 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 if x >= y { 13960 t.Errorf("%d >= %d", x, y) 13961 } 13962 } 13963 { 13964 var x int64 = 4294967296 13965 var y int64 = -9223372036854775808 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 if !(x >= y) { 13982 t.Errorf("!(%d >= %d)", x, y) 13983 } 13984 } 13985 { 13986 var x int64 = 4294967296 13987 var y int64 = -9223372036854775807 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 if !(x >= y) { 14004 t.Errorf("!(%d >= %d)", x, y) 14005 } 14006 } 14007 { 14008 var x int64 = 4294967296 14009 var y int64 = -4294967296 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 if !(x >= y) { 14026 t.Errorf("!(%d >= %d)", x, y) 14027 } 14028 } 14029 { 14030 var x int64 = 4294967296 14031 var y int64 = -1 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 if !(x >= y) { 14048 t.Errorf("!(%d >= %d)", x, y) 14049 } 14050 } 14051 { 14052 var x int64 = 4294967296 14053 var y int64 = 0 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 if !(x >= y) { 14070 t.Errorf("!(%d >= %d)", x, y) 14071 } 14072 } 14073 { 14074 var x int64 = 4294967296 14075 var y int64 = 1 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 if !(x >= y) { 14092 t.Errorf("!(%d >= %d)", x, y) 14093 } 14094 } 14095 { 14096 var x int64 = 4294967296 14097 var y int64 = 4294967296 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 if !(x >= y) { 14114 t.Errorf("!(%d >= %d)", x, y) 14115 } 14116 } 14117 { 14118 var x int64 = 4294967296 14119 var y int64 = 9223372036854775806 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 if x >= y { 14136 t.Errorf("%d >= %d", x, y) 14137 } 14138 } 14139 { 14140 var x int64 = 4294967296 14141 var y int64 = 9223372036854775807 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 if x >= y { 14158 t.Errorf("%d >= %d", x, y) 14159 } 14160 } 14161 { 14162 var x int64 = 9223372036854775806 14163 var y int64 = -9223372036854775808 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 if !(x >= y) { 14180 t.Errorf("!(%d >= %d)", x, y) 14181 } 14182 } 14183 { 14184 var x int64 = 9223372036854775806 14185 var y int64 = -9223372036854775807 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 if !(x >= y) { 14202 t.Errorf("!(%d >= %d)", x, y) 14203 } 14204 } 14205 { 14206 var x int64 = 9223372036854775806 14207 var y int64 = -4294967296 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 if !(x >= y) { 14224 t.Errorf("!(%d >= %d)", x, y) 14225 } 14226 } 14227 { 14228 var x int64 = 9223372036854775806 14229 var y int64 = -1 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 if !(x >= y) { 14246 t.Errorf("!(%d >= %d)", x, y) 14247 } 14248 } 14249 { 14250 var x int64 = 9223372036854775806 14251 var y int64 = 0 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 if !(x >= y) { 14268 t.Errorf("!(%d >= %d)", x, y) 14269 } 14270 } 14271 { 14272 var x int64 = 9223372036854775806 14273 var y int64 = 1 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 if !(x >= y) { 14290 t.Errorf("!(%d >= %d)", x, y) 14291 } 14292 } 14293 { 14294 var x int64 = 9223372036854775806 14295 var y int64 = 4294967296 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 if !(x >= y) { 14312 t.Errorf("!(%d >= %d)", x, y) 14313 } 14314 } 14315 { 14316 var x int64 = 9223372036854775806 14317 var y int64 = 9223372036854775806 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 if !(x >= y) { 14334 t.Errorf("!(%d >= %d)", x, y) 14335 } 14336 } 14337 { 14338 var x int64 = 9223372036854775806 14339 var y int64 = 9223372036854775807 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 if x >= y { 14356 t.Errorf("%d >= %d", x, y) 14357 } 14358 } 14359 { 14360 var x int64 = 9223372036854775807 14361 var y int64 = -9223372036854775808 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 if !(x >= y) { 14378 t.Errorf("!(%d >= %d)", x, y) 14379 } 14380 } 14381 { 14382 var x int64 = 9223372036854775807 14383 var y int64 = -9223372036854775807 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 if !(x >= y) { 14400 t.Errorf("!(%d >= %d)", x, y) 14401 } 14402 } 14403 { 14404 var x int64 = 9223372036854775807 14405 var y int64 = -4294967296 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 if !(x >= y) { 14422 t.Errorf("!(%d >= %d)", x, y) 14423 } 14424 } 14425 { 14426 var x int64 = 9223372036854775807 14427 var y int64 = -1 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 if !(x >= y) { 14444 t.Errorf("!(%d >= %d)", x, y) 14445 } 14446 } 14447 { 14448 var x int64 = 9223372036854775807 14449 var y int64 = 0 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 if !(x >= y) { 14466 t.Errorf("!(%d >= %d)", x, y) 14467 } 14468 } 14469 { 14470 var x int64 = 9223372036854775807 14471 var y int64 = 1 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 if !(x >= y) { 14488 t.Errorf("!(%d >= %d)", x, y) 14489 } 14490 } 14491 { 14492 var x int64 = 9223372036854775807 14493 var y int64 = 4294967296 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 if !(x >= y) { 14510 t.Errorf("!(%d >= %d)", x, y) 14511 } 14512 } 14513 { 14514 var x int64 = 9223372036854775807 14515 var y int64 = 9223372036854775806 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 if !(x >= y) { 14532 t.Errorf("!(%d >= %d)", x, y) 14533 } 14534 } 14535 { 14536 var x int64 = 9223372036854775807 14537 var y int64 = 9223372036854775807 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 if !(x >= y) { 14554 t.Errorf("!(%d >= %d)", x, y) 14555 } 14556 } 14557 } 14558 func TestConstFoldCompareuint32(t *testing.T) { 14559 { 14560 var x uint32 = 0 14561 var y uint32 = 0 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 if !(x >= y) { 14578 t.Errorf("!(%d >= %d)", x, y) 14579 } 14580 } 14581 { 14582 var x uint32 = 0 14583 var y uint32 = 1 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 if x >= y { 14600 t.Errorf("%d >= %d", x, y) 14601 } 14602 } 14603 { 14604 var x uint32 = 0 14605 var y uint32 = 4294967295 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 if x >= y { 14622 t.Errorf("%d >= %d", x, y) 14623 } 14624 } 14625 { 14626 var x uint32 = 1 14627 var y uint32 = 0 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 if !(x >= y) { 14644 t.Errorf("!(%d >= %d)", x, y) 14645 } 14646 } 14647 { 14648 var x uint32 = 1 14649 var y uint32 = 1 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 if !(x >= y) { 14666 t.Errorf("!(%d >= %d)", x, y) 14667 } 14668 } 14669 { 14670 var x uint32 = 1 14671 var y uint32 = 4294967295 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 if x >= y { 14688 t.Errorf("%d >= %d", x, y) 14689 } 14690 } 14691 { 14692 var x uint32 = 4294967295 14693 var y uint32 = 0 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 if !(x >= y) { 14710 t.Errorf("!(%d >= %d)", x, y) 14711 } 14712 } 14713 { 14714 var x uint32 = 4294967295 14715 var y uint32 = 1 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 if !(x >= y) { 14732 t.Errorf("!(%d >= %d)", x, y) 14733 } 14734 } 14735 { 14736 var x uint32 = 4294967295 14737 var y uint32 = 4294967295 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 if !(x >= y) { 14754 t.Errorf("!(%d >= %d)", x, y) 14755 } 14756 } 14757 } 14758 func TestConstFoldCompareint32(t *testing.T) { 14759 { 14760 var x int32 = -2147483648 14761 var y int32 = -2147483648 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 if !(x >= y) { 14778 t.Errorf("!(%d >= %d)", x, y) 14779 } 14780 } 14781 { 14782 var x int32 = -2147483648 14783 var y int32 = -2147483647 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 if x >= y { 14800 t.Errorf("%d >= %d", x, y) 14801 } 14802 } 14803 { 14804 var x int32 = -2147483648 14805 var y int32 = -1 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 if x >= y { 14822 t.Errorf("%d >= %d", x, y) 14823 } 14824 } 14825 { 14826 var x int32 = -2147483648 14827 var y int32 = 0 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 if x >= y { 14844 t.Errorf("%d >= %d", x, y) 14845 } 14846 } 14847 { 14848 var x int32 = -2147483648 14849 var y int32 = 1 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 if x >= y { 14866 t.Errorf("%d >= %d", x, y) 14867 } 14868 } 14869 { 14870 var x int32 = -2147483648 14871 var y int32 = 2147483647 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 if x >= y { 14888 t.Errorf("%d >= %d", x, y) 14889 } 14890 } 14891 { 14892 var x int32 = -2147483647 14893 var y int32 = -2147483648 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 if !(x >= y) { 14910 t.Errorf("!(%d >= %d)", x, y) 14911 } 14912 } 14913 { 14914 var x int32 = -2147483647 14915 var y int32 = -2147483647 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 if !(x >= y) { 14932 t.Errorf("!(%d >= %d)", x, y) 14933 } 14934 } 14935 { 14936 var x int32 = -2147483647 14937 var y int32 = -1 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 if x >= y { 14954 t.Errorf("%d >= %d", x, y) 14955 } 14956 } 14957 { 14958 var x int32 = -2147483647 14959 var y int32 = 0 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 if x >= y { 14976 t.Errorf("%d >= %d", x, y) 14977 } 14978 } 14979 { 14980 var x int32 = -2147483647 14981 var y int32 = 1 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 if x >= y { 14998 t.Errorf("%d >= %d", x, y) 14999 } 15000 } 15001 { 15002 var x int32 = -2147483647 15003 var y int32 = 2147483647 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 if x >= y { 15020 t.Errorf("%d >= %d", x, y) 15021 } 15022 } 15023 { 15024 var x int32 = -1 15025 var y int32 = -2147483648 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 if !(x >= y) { 15042 t.Errorf("!(%d >= %d)", x, y) 15043 } 15044 } 15045 { 15046 var x int32 = -1 15047 var y int32 = -2147483647 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 if !(x >= y) { 15064 t.Errorf("!(%d >= %d)", x, y) 15065 } 15066 } 15067 { 15068 var x int32 = -1 15069 var y int32 = -1 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 if !(x >= y) { 15086 t.Errorf("!(%d >= %d)", x, y) 15087 } 15088 } 15089 { 15090 var x int32 = -1 15091 var y int32 = 0 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 if x >= y { 15108 t.Errorf("%d >= %d", x, y) 15109 } 15110 } 15111 { 15112 var x int32 = -1 15113 var y int32 = 1 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 if x >= y { 15130 t.Errorf("%d >= %d", x, y) 15131 } 15132 } 15133 { 15134 var x int32 = -1 15135 var y int32 = 2147483647 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 if x >= y { 15152 t.Errorf("%d >= %d", x, y) 15153 } 15154 } 15155 { 15156 var x int32 = 0 15157 var y int32 = -2147483648 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 if !(x >= y) { 15174 t.Errorf("!(%d >= %d)", x, y) 15175 } 15176 } 15177 { 15178 var x int32 = 0 15179 var y int32 = -2147483647 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 if !(x >= y) { 15196 t.Errorf("!(%d >= %d)", x, y) 15197 } 15198 } 15199 { 15200 var x int32 = 0 15201 var y int32 = -1 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 if !(x >= y) { 15218 t.Errorf("!(%d >= %d)", x, y) 15219 } 15220 } 15221 { 15222 var x int32 = 0 15223 var y int32 = 0 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 if !(x >= y) { 15240 t.Errorf("!(%d >= %d)", x, y) 15241 } 15242 } 15243 { 15244 var x int32 = 0 15245 var y int32 = 1 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 if x >= y { 15262 t.Errorf("%d >= %d", x, y) 15263 } 15264 } 15265 { 15266 var x int32 = 0 15267 var y int32 = 2147483647 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 if x >= y { 15284 t.Errorf("%d >= %d", x, y) 15285 } 15286 } 15287 { 15288 var x int32 = 1 15289 var y int32 = -2147483648 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 if !(x >= y) { 15306 t.Errorf("!(%d >= %d)", x, y) 15307 } 15308 } 15309 { 15310 var x int32 = 1 15311 var y int32 = -2147483647 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 if !(x >= y) { 15328 t.Errorf("!(%d >= %d)", x, y) 15329 } 15330 } 15331 { 15332 var x int32 = 1 15333 var y int32 = -1 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 if !(x >= y) { 15350 t.Errorf("!(%d >= %d)", x, y) 15351 } 15352 } 15353 { 15354 var x int32 = 1 15355 var y int32 = 0 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 if !(x >= y) { 15372 t.Errorf("!(%d >= %d)", x, y) 15373 } 15374 } 15375 { 15376 var x int32 = 1 15377 var y int32 = 1 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 if !(x >= y) { 15394 t.Errorf("!(%d >= %d)", x, y) 15395 } 15396 } 15397 { 15398 var x int32 = 1 15399 var y int32 = 2147483647 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 if x >= y { 15416 t.Errorf("%d >= %d", x, y) 15417 } 15418 } 15419 { 15420 var x int32 = 2147483647 15421 var y int32 = -2147483648 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 if !(x >= y) { 15438 t.Errorf("!(%d >= %d)", x, y) 15439 } 15440 } 15441 { 15442 var x int32 = 2147483647 15443 var y int32 = -2147483647 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 if !(x >= y) { 15460 t.Errorf("!(%d >= %d)", x, y) 15461 } 15462 } 15463 { 15464 var x int32 = 2147483647 15465 var y int32 = -1 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 if !(x >= y) { 15482 t.Errorf("!(%d >= %d)", x, y) 15483 } 15484 } 15485 { 15486 var x int32 = 2147483647 15487 var y int32 = 0 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 if !(x >= y) { 15504 t.Errorf("!(%d >= %d)", x, y) 15505 } 15506 } 15507 { 15508 var x int32 = 2147483647 15509 var y int32 = 1 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 if !(x >= y) { 15526 t.Errorf("!(%d >= %d)", x, y) 15527 } 15528 } 15529 { 15530 var x int32 = 2147483647 15531 var y int32 = 2147483647 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 if !(x >= y) { 15548 t.Errorf("!(%d >= %d)", x, y) 15549 } 15550 } 15551 } 15552 func TestConstFoldCompareuint16(t *testing.T) { 15553 { 15554 var x uint16 = 0 15555 var y uint16 = 0 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 if !(x >= y) { 15572 t.Errorf("!(%d >= %d)", x, y) 15573 } 15574 } 15575 { 15576 var x uint16 = 0 15577 var y uint16 = 1 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 if x >= y { 15594 t.Errorf("%d >= %d", x, y) 15595 } 15596 } 15597 { 15598 var x uint16 = 0 15599 var y uint16 = 65535 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 if x >= y { 15616 t.Errorf("%d >= %d", x, y) 15617 } 15618 } 15619 { 15620 var x uint16 = 1 15621 var y uint16 = 0 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 if !(x >= y) { 15638 t.Errorf("!(%d >= %d)", x, y) 15639 } 15640 } 15641 { 15642 var x uint16 = 1 15643 var y uint16 = 1 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 if !(x >= y) { 15660 t.Errorf("!(%d >= %d)", x, y) 15661 } 15662 } 15663 { 15664 var x uint16 = 1 15665 var y uint16 = 65535 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 if x >= y { 15682 t.Errorf("%d >= %d", x, y) 15683 } 15684 } 15685 { 15686 var x uint16 = 65535 15687 var y uint16 = 0 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 if !(x >= y) { 15704 t.Errorf("!(%d >= %d)", x, y) 15705 } 15706 } 15707 { 15708 var x uint16 = 65535 15709 var y uint16 = 1 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 if !(x >= y) { 15726 t.Errorf("!(%d >= %d)", x, y) 15727 } 15728 } 15729 { 15730 var x uint16 = 65535 15731 var y uint16 = 65535 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 if !(x >= y) { 15748 t.Errorf("!(%d >= %d)", x, y) 15749 } 15750 } 15751 } 15752 func TestConstFoldCompareint16(t *testing.T) { 15753 { 15754 var x int16 = -32768 15755 var y int16 = -32768 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 if !(x >= y) { 15772 t.Errorf("!(%d >= %d)", x, y) 15773 } 15774 } 15775 { 15776 var x int16 = -32768 15777 var y int16 = -32767 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 if x >= y { 15794 t.Errorf("%d >= %d", x, y) 15795 } 15796 } 15797 { 15798 var x int16 = -32768 15799 var y int16 = -1 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 if x >= y { 15816 t.Errorf("%d >= %d", x, y) 15817 } 15818 } 15819 { 15820 var x int16 = -32768 15821 var y int16 = 0 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 if x >= y { 15838 t.Errorf("%d >= %d", x, y) 15839 } 15840 } 15841 { 15842 var x int16 = -32768 15843 var y int16 = 1 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 if x >= y { 15860 t.Errorf("%d >= %d", x, y) 15861 } 15862 } 15863 { 15864 var x int16 = -32768 15865 var y int16 = 32766 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 if x >= y { 15882 t.Errorf("%d >= %d", x, y) 15883 } 15884 } 15885 { 15886 var x int16 = -32768 15887 var y int16 = 32767 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 if x >= y { 15904 t.Errorf("%d >= %d", x, y) 15905 } 15906 } 15907 { 15908 var x int16 = -32767 15909 var y int16 = -32768 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 if !(x >= y) { 15926 t.Errorf("!(%d >= %d)", x, y) 15927 } 15928 } 15929 { 15930 var x int16 = -32767 15931 var y int16 = -32767 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 if !(x >= y) { 15948 t.Errorf("!(%d >= %d)", x, y) 15949 } 15950 } 15951 { 15952 var x int16 = -32767 15953 var y int16 = -1 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 if x >= y { 15970 t.Errorf("%d >= %d", x, y) 15971 } 15972 } 15973 { 15974 var x int16 = -32767 15975 var y int16 = 0 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 if x >= y { 15992 t.Errorf("%d >= %d", x, y) 15993 } 15994 } 15995 { 15996 var x int16 = -32767 15997 var y int16 = 1 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 if x >= y { 16014 t.Errorf("%d >= %d", x, y) 16015 } 16016 } 16017 { 16018 var x int16 = -32767 16019 var y int16 = 32766 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 if x >= y { 16036 t.Errorf("%d >= %d", x, y) 16037 } 16038 } 16039 { 16040 var x int16 = -32767 16041 var y int16 = 32767 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 if x >= y { 16058 t.Errorf("%d >= %d", x, y) 16059 } 16060 } 16061 { 16062 var x int16 = -1 16063 var y int16 = -32768 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 if !(x >= y) { 16080 t.Errorf("!(%d >= %d)", x, y) 16081 } 16082 } 16083 { 16084 var x int16 = -1 16085 var y int16 = -32767 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 if !(x >= y) { 16102 t.Errorf("!(%d >= %d)", x, y) 16103 } 16104 } 16105 { 16106 var x int16 = -1 16107 var y int16 = -1 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 if !(x >= y) { 16124 t.Errorf("!(%d >= %d)", x, y) 16125 } 16126 } 16127 { 16128 var x int16 = -1 16129 var y int16 = 0 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 if x >= y { 16146 t.Errorf("%d >= %d", x, y) 16147 } 16148 } 16149 { 16150 var x int16 = -1 16151 var y int16 = 1 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 if x >= y { 16168 t.Errorf("%d >= %d", x, y) 16169 } 16170 } 16171 { 16172 var x int16 = -1 16173 var y int16 = 32766 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 if x >= y { 16190 t.Errorf("%d >= %d", x, y) 16191 } 16192 } 16193 { 16194 var x int16 = -1 16195 var y int16 = 32767 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 if x >= y { 16212 t.Errorf("%d >= %d", x, y) 16213 } 16214 } 16215 { 16216 var x int16 = 0 16217 var y int16 = -32768 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 if !(x >= y) { 16234 t.Errorf("!(%d >= %d)", x, y) 16235 } 16236 } 16237 { 16238 var x int16 = 0 16239 var y int16 = -32767 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 if !(x >= y) { 16256 t.Errorf("!(%d >= %d)", x, y) 16257 } 16258 } 16259 { 16260 var x int16 = 0 16261 var y int16 = -1 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 if !(x >= y) { 16278 t.Errorf("!(%d >= %d)", x, y) 16279 } 16280 } 16281 { 16282 var x int16 = 0 16283 var y int16 = 0 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 if !(x >= y) { 16300 t.Errorf("!(%d >= %d)", x, y) 16301 } 16302 } 16303 { 16304 var x int16 = 0 16305 var y int16 = 1 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 if x >= y { 16322 t.Errorf("%d >= %d", x, y) 16323 } 16324 } 16325 { 16326 var x int16 = 0 16327 var y int16 = 32766 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 if x >= y { 16344 t.Errorf("%d >= %d", x, y) 16345 } 16346 } 16347 { 16348 var x int16 = 0 16349 var y int16 = 32767 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 if x >= y { 16366 t.Errorf("%d >= %d", x, y) 16367 } 16368 } 16369 { 16370 var x int16 = 1 16371 var y int16 = -32768 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 if !(x >= y) { 16388 t.Errorf("!(%d >= %d)", x, y) 16389 } 16390 } 16391 { 16392 var x int16 = 1 16393 var y int16 = -32767 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 if !(x >= y) { 16410 t.Errorf("!(%d >= %d)", x, y) 16411 } 16412 } 16413 { 16414 var x int16 = 1 16415 var y int16 = -1 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 if !(x >= y) { 16432 t.Errorf("!(%d >= %d)", x, y) 16433 } 16434 } 16435 { 16436 var x int16 = 1 16437 var y int16 = 0 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 if !(x >= y) { 16454 t.Errorf("!(%d >= %d)", x, y) 16455 } 16456 } 16457 { 16458 var x int16 = 1 16459 var y int16 = 1 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 if !(x >= y) { 16476 t.Errorf("!(%d >= %d)", x, y) 16477 } 16478 } 16479 { 16480 var x int16 = 1 16481 var y int16 = 32766 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 if x >= y { 16498 t.Errorf("%d >= %d", x, y) 16499 } 16500 } 16501 { 16502 var x int16 = 1 16503 var y int16 = 32767 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 if x >= y { 16520 t.Errorf("%d >= %d", x, y) 16521 } 16522 } 16523 { 16524 var x int16 = 32766 16525 var y int16 = -32768 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 if !(x >= y) { 16542 t.Errorf("!(%d >= %d)", x, y) 16543 } 16544 } 16545 { 16546 var x int16 = 32766 16547 var y int16 = -32767 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 if !(x >= y) { 16564 t.Errorf("!(%d >= %d)", x, y) 16565 } 16566 } 16567 { 16568 var x int16 = 32766 16569 var y int16 = -1 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 if !(x >= y) { 16586 t.Errorf("!(%d >= %d)", x, y) 16587 } 16588 } 16589 { 16590 var x int16 = 32766 16591 var y int16 = 0 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 if !(x >= y) { 16608 t.Errorf("!(%d >= %d)", x, y) 16609 } 16610 } 16611 { 16612 var x int16 = 32766 16613 var y int16 = 1 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 if !(x >= y) { 16630 t.Errorf("!(%d >= %d)", x, y) 16631 } 16632 } 16633 { 16634 var x int16 = 32766 16635 var y int16 = 32766 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 if !(x >= y) { 16652 t.Errorf("!(%d >= %d)", x, y) 16653 } 16654 } 16655 { 16656 var x int16 = 32766 16657 var y int16 = 32767 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 if x >= y { 16674 t.Errorf("%d >= %d", x, y) 16675 } 16676 } 16677 { 16678 var x int16 = 32767 16679 var y int16 = -32768 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 if !(x >= y) { 16696 t.Errorf("!(%d >= %d)", x, y) 16697 } 16698 } 16699 { 16700 var x int16 = 32767 16701 var y int16 = -32767 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 if !(x >= y) { 16718 t.Errorf("!(%d >= %d)", x, y) 16719 } 16720 } 16721 { 16722 var x int16 = 32767 16723 var y int16 = -1 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 if !(x >= y) { 16740 t.Errorf("!(%d >= %d)", x, y) 16741 } 16742 } 16743 { 16744 var x int16 = 32767 16745 var y int16 = 0 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 if !(x >= y) { 16762 t.Errorf("!(%d >= %d)", x, y) 16763 } 16764 } 16765 { 16766 var x int16 = 32767 16767 var y int16 = 1 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 if !(x >= y) { 16784 t.Errorf("!(%d >= %d)", x, y) 16785 } 16786 } 16787 { 16788 var x int16 = 32767 16789 var y int16 = 32766 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 if !(x >= y) { 16806 t.Errorf("!(%d >= %d)", x, y) 16807 } 16808 } 16809 { 16810 var x int16 = 32767 16811 var y int16 = 32767 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 if !(x >= y) { 16828 t.Errorf("!(%d >= %d)", x, y) 16829 } 16830 } 16831 } 16832 func TestConstFoldCompareuint8(t *testing.T) { 16833 { 16834 var x uint8 = 0 16835 var y uint8 = 0 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 if !(x >= y) { 16852 t.Errorf("!(%d >= %d)", x, y) 16853 } 16854 } 16855 { 16856 var x uint8 = 0 16857 var y uint8 = 1 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 if x >= y { 16874 t.Errorf("%d >= %d", x, y) 16875 } 16876 } 16877 { 16878 var x uint8 = 0 16879 var y uint8 = 255 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 if x >= y { 16896 t.Errorf("%d >= %d", x, y) 16897 } 16898 } 16899 { 16900 var x uint8 = 1 16901 var y uint8 = 0 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 if !(x >= y) { 16918 t.Errorf("!(%d >= %d)", x, y) 16919 } 16920 } 16921 { 16922 var x uint8 = 1 16923 var y uint8 = 1 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 if !(x >= y) { 16940 t.Errorf("!(%d >= %d)", x, y) 16941 } 16942 } 16943 { 16944 var x uint8 = 1 16945 var y uint8 = 255 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 if x >= y { 16962 t.Errorf("%d >= %d", x, y) 16963 } 16964 } 16965 { 16966 var x uint8 = 255 16967 var y uint8 = 0 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 if !(x >= y) { 16984 t.Errorf("!(%d >= %d)", x, y) 16985 } 16986 } 16987 { 16988 var x uint8 = 255 16989 var y uint8 = 1 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 if !(x >= y) { 17006 t.Errorf("!(%d >= %d)", x, y) 17007 } 17008 } 17009 { 17010 var x uint8 = 255 17011 var y uint8 = 255 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 if !(x >= y) { 17028 t.Errorf("!(%d >= %d)", x, y) 17029 } 17030 } 17031 } 17032 func TestConstFoldCompareint8(t *testing.T) { 17033 { 17034 var x int8 = -128 17035 var y int8 = -128 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 if !(x >= y) { 17052 t.Errorf("!(%d >= %d)", x, y) 17053 } 17054 } 17055 { 17056 var x int8 = -128 17057 var y int8 = -127 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 if x >= y { 17074 t.Errorf("%d >= %d", x, y) 17075 } 17076 } 17077 { 17078 var x int8 = -128 17079 var y int8 = -1 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 if x >= y { 17096 t.Errorf("%d >= %d", x, y) 17097 } 17098 } 17099 { 17100 var x int8 = -128 17101 var y int8 = 0 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 if x >= y { 17118 t.Errorf("%d >= %d", x, y) 17119 } 17120 } 17121 { 17122 var x int8 = -128 17123 var y int8 = 1 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 if x >= y { 17140 t.Errorf("%d >= %d", x, y) 17141 } 17142 } 17143 { 17144 var x int8 = -128 17145 var y int8 = 126 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 if x >= y { 17162 t.Errorf("%d >= %d", x, y) 17163 } 17164 } 17165 { 17166 var x int8 = -128 17167 var y int8 = 127 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 if x >= y { 17184 t.Errorf("%d >= %d", x, y) 17185 } 17186 } 17187 { 17188 var x int8 = -127 17189 var y int8 = -128 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 if !(x >= y) { 17206 t.Errorf("!(%d >= %d)", x, y) 17207 } 17208 } 17209 { 17210 var x int8 = -127 17211 var y int8 = -127 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 if !(x >= y) { 17228 t.Errorf("!(%d >= %d)", x, y) 17229 } 17230 } 17231 { 17232 var x int8 = -127 17233 var y int8 = -1 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 if x >= y { 17250 t.Errorf("%d >= %d", x, y) 17251 } 17252 } 17253 { 17254 var x int8 = -127 17255 var y int8 = 0 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 if x >= y { 17272 t.Errorf("%d >= %d", x, y) 17273 } 17274 } 17275 { 17276 var x int8 = -127 17277 var y int8 = 1 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 if x >= y { 17294 t.Errorf("%d >= %d", x, y) 17295 } 17296 } 17297 { 17298 var x int8 = -127 17299 var y int8 = 126 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 if x >= y { 17316 t.Errorf("%d >= %d", x, y) 17317 } 17318 } 17319 { 17320 var x int8 = -127 17321 var y int8 = 127 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 if x >= y { 17338 t.Errorf("%d >= %d", x, y) 17339 } 17340 } 17341 { 17342 var x int8 = -1 17343 var y int8 = -128 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 if !(x >= y) { 17360 t.Errorf("!(%d >= %d)", x, y) 17361 } 17362 } 17363 { 17364 var x int8 = -1 17365 var y int8 = -127 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 if !(x >= y) { 17382 t.Errorf("!(%d >= %d)", x, y) 17383 } 17384 } 17385 { 17386 var x int8 = -1 17387 var y int8 = -1 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 if !(x >= y) { 17404 t.Errorf("!(%d >= %d)", x, y) 17405 } 17406 } 17407 { 17408 var x int8 = -1 17409 var y int8 = 0 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 if x >= y { 17426 t.Errorf("%d >= %d", x, y) 17427 } 17428 } 17429 { 17430 var x int8 = -1 17431 var y int8 = 1 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 if x >= y { 17448 t.Errorf("%d >= %d", x, y) 17449 } 17450 } 17451 { 17452 var x int8 = -1 17453 var y int8 = 126 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 if x >= y { 17470 t.Errorf("%d >= %d", x, y) 17471 } 17472 } 17473 { 17474 var x int8 = -1 17475 var y int8 = 127 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 if x >= y { 17492 t.Errorf("%d >= %d", x, y) 17493 } 17494 } 17495 { 17496 var x int8 = 0 17497 var y int8 = -128 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 if !(x >= y) { 17514 t.Errorf("!(%d >= %d)", x, y) 17515 } 17516 } 17517 { 17518 var x int8 = 0 17519 var y int8 = -127 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 if !(x >= y) { 17536 t.Errorf("!(%d >= %d)", x, y) 17537 } 17538 } 17539 { 17540 var x int8 = 0 17541 var y int8 = -1 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 if !(x >= y) { 17558 t.Errorf("!(%d >= %d)", x, y) 17559 } 17560 } 17561 { 17562 var x int8 = 0 17563 var y int8 = 0 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 if !(x >= y) { 17580 t.Errorf("!(%d >= %d)", x, y) 17581 } 17582 } 17583 { 17584 var x int8 = 0 17585 var y int8 = 1 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 if x >= y { 17602 t.Errorf("%d >= %d", x, y) 17603 } 17604 } 17605 { 17606 var x int8 = 0 17607 var y int8 = 126 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 if x >= y { 17624 t.Errorf("%d >= %d", x, y) 17625 } 17626 } 17627 { 17628 var x int8 = 0 17629 var y int8 = 127 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 if x >= y { 17646 t.Errorf("%d >= %d", x, y) 17647 } 17648 } 17649 { 17650 var x int8 = 1 17651 var y int8 = -128 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 if !(x >= y) { 17668 t.Errorf("!(%d >= %d)", x, y) 17669 } 17670 } 17671 { 17672 var x int8 = 1 17673 var y int8 = -127 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 if !(x >= y) { 17690 t.Errorf("!(%d >= %d)", x, y) 17691 } 17692 } 17693 { 17694 var x int8 = 1 17695 var y int8 = -1 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 if !(x >= y) { 17712 t.Errorf("!(%d >= %d)", x, y) 17713 } 17714 } 17715 { 17716 var x int8 = 1 17717 var y int8 = 0 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 if !(x >= y) { 17734 t.Errorf("!(%d >= %d)", x, y) 17735 } 17736 } 17737 { 17738 var x int8 = 1 17739 var y int8 = 1 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 if !(x >= y) { 17756 t.Errorf("!(%d >= %d)", x, y) 17757 } 17758 } 17759 { 17760 var x int8 = 1 17761 var y int8 = 126 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 if x >= y { 17778 t.Errorf("%d >= %d", x, y) 17779 } 17780 } 17781 { 17782 var x int8 = 1 17783 var y int8 = 127 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 if x >= y { 17800 t.Errorf("%d >= %d", x, y) 17801 } 17802 } 17803 { 17804 var x int8 = 126 17805 var y int8 = -128 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 if !(x >= y) { 17822 t.Errorf("!(%d >= %d)", x, y) 17823 } 17824 } 17825 { 17826 var x int8 = 126 17827 var y int8 = -127 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 if !(x >= y) { 17844 t.Errorf("!(%d >= %d)", x, y) 17845 } 17846 } 17847 { 17848 var x int8 = 126 17849 var y int8 = -1 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 if !(x >= y) { 17866 t.Errorf("!(%d >= %d)", x, y) 17867 } 17868 } 17869 { 17870 var x int8 = 126 17871 var y int8 = 0 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 if !(x >= y) { 17888 t.Errorf("!(%d >= %d)", x, y) 17889 } 17890 } 17891 { 17892 var x int8 = 126 17893 var y int8 = 1 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 if !(x >= y) { 17910 t.Errorf("!(%d >= %d)", x, y) 17911 } 17912 } 17913 { 17914 var x int8 = 126 17915 var y int8 = 126 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 if !(x >= y) { 17932 t.Errorf("!(%d >= %d)", x, y) 17933 } 17934 } 17935 { 17936 var x int8 = 126 17937 var y int8 = 127 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 if x >= y { 17954 t.Errorf("%d >= %d", x, y) 17955 } 17956 } 17957 { 17958 var x int8 = 127 17959 var y int8 = -128 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 if !(x >= y) { 17976 t.Errorf("!(%d >= %d)", x, y) 17977 } 17978 } 17979 { 17980 var x int8 = 127 17981 var y int8 = -127 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 if !(x >= y) { 17998 t.Errorf("!(%d >= %d)", x, y) 17999 } 18000 } 18001 { 18002 var x int8 = 127 18003 var y int8 = -1 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 if !(x >= y) { 18020 t.Errorf("!(%d >= %d)", x, y) 18021 } 18022 } 18023 { 18024 var x int8 = 127 18025 var y int8 = 0 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 if !(x >= y) { 18042 t.Errorf("!(%d >= %d)", x, y) 18043 } 18044 } 18045 { 18046 var x int8 = 127 18047 var y int8 = 1 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 if !(x >= y) { 18064 t.Errorf("!(%d >= %d)", x, y) 18065 } 18066 } 18067 { 18068 var x int8 = 127 18069 var y int8 = 126 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 if !(x >= y) { 18086 t.Errorf("!(%d >= %d)", x, y) 18087 } 18088 } 18089 { 18090 var x int8 = 127 18091 var y int8 = 127 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 if !(x >= y) { 18108 t.Errorf("!(%d >= %d)", x, y) 18109 } 18110 } 18111 }