summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/leadz_trailz_2.f90
blob: 08701d8a537ce0ad41bd76f6c4fe14e679c29f78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
! { dg-do run }
! { dg-require-effective-target fortran_large_int }

  integer(kind=16) :: i16

  i16 = -1
  if (leadz(i16) /= 0) call abort
  if (trailz(i16) /= 0) call abort
  if (leadz(-1_16) /= 0) call abort
  if (trailz(-1_16) /= 0) call abort

  i16 = -64
  if (leadz(i16) /= 0) call abort
  if (trailz(i16) /= 6) call abort
  if (leadz(-64_16) /= 0) call abort
  if (trailz(-64_16) /= 6) call abort

  i16 = -108
  if (leadz(i16) /= 0) call abort
  if (trailz(i16) /= 2) call abort
  if (leadz(-108_16) /= 0) call abort
  if (trailz(-108_16) /= 2) call abort

  i16 = 1
  if (leadz(i16) /= bit_size(i16) - 1) call abort
  if (trailz(i16) /= 0) call abort
  if (leadz(1_16) /= bit_size(1_16) - 1) call abort
  if (trailz(1_16) /= 0) call abort

  i16 = 64
  if (leadz(i16) /= 121) call abort
  if (trailz(i16) /= 6) call abort
  if (leadz(64_16) /= 121) call abort
  if (trailz(64_16) /= 6) call abort

end