llvm.org GIT mirror llvm / 9030f9a
[x86] add tests for bt/test; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369812 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 25 days ago
1 changed file(s) with 110 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
389389 ret void
390390 }
391391
392 define i64 @is_upper_bit_clear_i64(i64 %x) {
393 ; CHECK-LABEL: is_upper_bit_clear_i64:
394 ; CHECK: # %bb.0:
395 ; CHECK-NEXT: movq %rdi, %rax
396 ; CHECK-NEXT: shrq $37, %rax
397 ; CHECK-NEXT: notl %eax
398 ; CHECK-NEXT: andl $1, %eax
399 ; CHECK-NEXT: retq
400 %sh = lshr i64 %x, 37
401 %m = and i64 %sh, 1
402 %r = xor i64 %m, 1
403 ret i64 %r
404 }
405
406 define i64 @is_lower_bit_clear_i64(i64 %x) {
407 ; CHECK-LABEL: is_lower_bit_clear_i64:
408 ; CHECK: # %bb.0:
409 ; CHECK-NEXT: movq %rdi, %rax
410 ; CHECK-NEXT: shrl $27, %eax
411 ; CHECK-NEXT: notl %eax
412 ; CHECK-NEXT: andl $1, %eax
413 ; CHECK-NEXT: retq
414 %sh = lshr i64 %x, 27
415 %m = and i64 %sh, 1
416 %r = xor i64 %m, 1
417 ret i64 %r
418 }
419
420 define i32 @is_bit_clear_i32(i32 %x) {
421 ; CHECK-LABEL: is_bit_clear_i32:
422 ; CHECK: # %bb.0:
423 ; CHECK-NEXT: movl %edi, %eax
424 ; CHECK-NEXT: shrl $27, %eax
425 ; CHECK-NEXT: notl %eax
426 ; CHECK-NEXT: andl $1, %eax
427 ; CHECK-NEXT: retq
428 %sh = lshr i32 %x, 27
429 %n = xor i32 %sh, -1
430 %r = and i32 %n, 1
431 ret i32 %r
432 }
433
434 define i16 @is_bit_clear_i16(i16 %x) {
435 ; CHECK-LABEL: is_bit_clear_i16:
436 ; CHECK: # %bb.0:
437 ; CHECK-NEXT: movzwl %di, %eax
438 ; CHECK-NEXT: shrl $7, %eax
439 ; CHECK-NEXT: notl %eax
440 ; CHECK-NEXT: andl $1, %eax
441 ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
442 ; CHECK-NEXT: retq
443 %sh = lshr i16 %x, 7
444 %m = and i16 %sh, 1
445 %r = xor i16 %m, 1
446 ret i16 %r
447 }
448
449 define i8 @is_bit_clear_i8(i8 %x) {
450 ; CHECK-LABEL: is_bit_clear_i8:
451 ; CHECK: # %bb.0:
452 ; CHECK-NEXT: movl %edi, %eax
453 ; CHECK-NEXT: shrb $3, %al
454 ; CHECK-NEXT: notb %al
455 ; CHECK-NEXT: andb $1, %al
456 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
457 ; CHECK-NEXT: retq
458 %sh = lshr i8 %x, 3
459 %m = and i8 %sh, 1
460 %r = xor i8 %m, 1
461 ret i8 %r
462 }
463
464 define i32 @setcc_is_bit_clear(i32 %x) {
465 ; CHECK-LABEL: setcc_is_bit_clear:
466 ; CHECK: # %bb.0:
467 ; CHECK-NEXT: xorl %eax, %eax
468 ; CHECK-NEXT: testl $1024, %edi # imm = 0x400
469 ; CHECK-NEXT: sete %al
470 ; CHECK-NEXT: retq
471 %a1 = and i32 %x, 1024
472 %b1 = icmp eq i32 %a1, 0
473 %r = zext i1 %b1 to i32
474 ret i32 %r
475 }
476
477 define i32 @is_bit_set(i32 %x) {
478 ; CHECK-LABEL: is_bit_set:
479 ; CHECK: # %bb.0:
480 ; CHECK-NEXT: movl %edi, %eax
481 ; CHECK-NEXT: shrl $10, %eax
482 ; CHECK-NEXT: andl $1, %eax
483 ; CHECK-NEXT: retq
484 %sh = lshr i32 %x, 10
485 %m = and i32 %sh, 1
486 ret i32 %m
487 }
488
489 define i32 @setcc_is_bit_set(i32 %x) {
490 ; CHECK-LABEL: setcc_is_bit_set:
491 ; CHECK: # %bb.0:
492 ; CHECK-NEXT: movl %edi, %eax
493 ; CHECK-NEXT: shrl $10, %eax
494 ; CHECK-NEXT: andl $1, %eax
495 ; CHECK-NEXT: retq
496 %a1 = and i32 %x, 1024
497 %b1 = icmp ne i32 %a1, 0
498 %r = zext i1 %b1 to i32
499 ret i32 %r
500 }
501
392502 declare void @bar()