[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Evaluate / fold-mask.f90
blob741003011cab0f3dfcb23b3fbf9ba32c62436753
1 ! RUN: %python %S/test_folding.py %s %flang_fc1
3 ! Test mask intrinsic folding
5 module maskltest
6 logical, parameter :: test_l0 = maskl(0) .EQ. 0
7 logical, parameter :: test_l1 = maskl(1) .EQ. -2147483648_8
8 logical, parameter :: test_l2 = maskl(2) .EQ. -1073741824
9 logical, parameter :: test_lm = maskl(16) .EQ. -65536
10 logical, parameter :: test_le1 = maskl(31) .EQ. -2
11 logical, parameter :: test_le = maskl(32) .EQ. -1
12 logical, parameter :: test_lo = maskl(33) .EQ. -1
14 logical, parameter :: test_l0_1 = maskl(0, 1) .EQ. 0_1
15 logical, parameter :: test_l1_1 = maskl(1, 1) .EQ. -128_2
16 logical, parameter :: test_l2_1 = maskl(2, 1) .EQ. -64_1
17 logical, parameter :: test_lm_1 = maskl(4, 1) .EQ. -16_1
18 logical, parameter :: test_le1_1 = maskl(7, 1) .EQ. -2_1
19 logical, parameter :: test_le_1 = maskl(8, 1) .EQ. -1_1
20 logical, parameter :: test_lo_1 = maskl(9, 1) .EQ. -1_1
22 logical, parameter :: test_l0_2 = maskl(0, 2) .EQ. 0_2
23 logical, parameter :: test_l1_2 = maskl(1, 2) .EQ. -32768_4
24 logical, parameter :: test_l2_2 = maskl(2, 2) .EQ. -16384_2
25 logical, parameter :: test_lm_2 = maskl(8, 2) .EQ. -256_2
26 logical, parameter :: test_le1_2 = maskl(15, 2) .EQ. -2_2
27 logical, parameter :: test_le_2 = maskl(16, 2) .EQ. -1_2
28 logical, parameter :: test_lo_2 = maskl(17, 2) .EQ. -1_2
30 logical, parameter :: test_l0_4 = maskl(0, 4) .EQ. 0_4
31 logical, parameter :: test_l1_4 = maskl(1, 4) .EQ. -2147483648_8
32 logical, parameter :: test_l2_4 = maskl(2, 4) .EQ. -1073741824_4
33 logical, parameter :: test_lm_4 = maskl(16, 4) .EQ. -65536_4
34 logical, parameter :: test_le1_4 = maskl(31, 4) .EQ. -2_4
35 logical, parameter :: test_le_4 = maskl(32, 4) .EQ. -1_4
36 logical, parameter :: test_lo_4 = maskl(33, 4) .EQ. -1_4
38 logical, parameter :: test_l0_8 = maskl(0, 8) .EQ. 0_8
39 logical, parameter :: test_l1_8 = maskl(1, 8) .EQ. -9223372036854775808_16
40 logical, parameter :: test_l2_8 = maskl(2, 8) .EQ. -4611686018427387904_8
41 logical, parameter :: test_lm_8 = maskl(32, 8) .EQ. -4294967296_8
42 logical, parameter :: test_le1_8 = maskl(63, 8) .EQ. -2_8
43 logical, parameter :: test_le_8 = maskl(64, 8) .EQ. -1_8
44 logical, parameter :: test_lo_8 = maskl(65, 8) .EQ. -1_8
46 logical, parameter :: test_l0_16 = maskl(0, 16) .EQ. 0_16
47 logical, parameter :: test_l2_16 = maskl(2, 16) .EQ. -85070591730234615865843651857942052864_16
48 logical, parameter :: test_lm_16 = maskl(64, 16) .EQ. -18446744073709551616_16
49 logical, parameter :: test_le1_16 = maskl(127, 16) .EQ. -2_16
50 logical, parameter :: test_le_16 = maskl(128, 16) .EQ. -1_16
51 logical, parameter :: test_lo_16 = maskl(129, 16) .EQ. -1_16
52 end module maskltest
54 module maskrtest
55 logical, parameter :: test_r0 = maskr(0) .EQ. 0
56 logical, parameter :: test_r1 = maskr(1) .EQ. 1
57 logical, parameter :: test_r2 = maskr(2) .EQ. 3
58 logical, parameter :: test_rm = maskr(16) .EQ. 65535
59 logical, parameter :: test_re1 = maskr(31) .EQ. 2147483647
60 logical, parameter :: test_re = maskr(32) .EQ. -1
61 logical, parameter :: test_ro = maskr(33) .EQ. -1
63 logical, parameter :: test_r0_1 = maskr(0, 1) .EQ. 0_1
64 logical, parameter :: test_r1_1 = maskr(1, 1) .EQ. 1_1
65 logical, parameter :: test_r2_1 = maskr(2, 1) .EQ. 3_1
66 logical, parameter :: test_rm_1 = maskr(4, 1) .EQ. 15_1
67 logical, parameter :: test_re1_1 = maskr(7, 1) .EQ. 127_1
68 logical, parameter :: test_re_1 = maskr(8, 1) .EQ. -1_1
69 logical, parameter :: test_ro_1 = maskr(9, 1) .EQ. -1_1
71 logical, parameter :: test_r0_2 = maskr(0, 2) .EQ. 0_2
72 logical, parameter :: test_r1_2 = maskr(1, 2) .EQ. 1_2
73 logical, parameter :: test_r2_2 = maskr(2, 2) .EQ. 3_2
74 logical, parameter :: test_rm_2 = maskr(8, 2) .EQ. 255_2
75 logical, parameter :: test_re1_2 = maskr(15, 2) .EQ. 32767_2
76 logical, parameter :: test_re_2 = maskr(16, 2) .EQ. -1_2
77 logical, parameter :: test_ro_2 = maskr(17, 2) .EQ. -1_2
79 logical, parameter :: test_r0_4 = maskr(0, 4) .EQ. 0_4
80 logical, parameter :: test_r1_4 = maskr(1, 4) .EQ. 1_4
81 logical, parameter :: test_r2_4 = maskr(2, 4) .EQ. 3_4
82 logical, parameter :: test_rm_4 = maskr(16, 4) .EQ. 65535_4
83 logical, parameter :: test_re1_4 = maskr(31, 4) .EQ. 2147483647_4
84 logical, parameter :: test_re_4 = maskr(32, 4) .EQ. -1_4
85 logical, parameter :: test_ro_4 = maskr(33, 4) .EQ. -1_4
87 logical, parameter :: test_r0_8 = maskr(0, 8) .EQ. 0_8
88 logical, parameter :: test_r1_8 = maskr(1, 8) .EQ. 1_8
89 logical, parameter :: test_r2_8 = maskr(2, 8) .EQ. 3_8
90 logical, parameter :: test_rm_8 = maskr(32, 8) .EQ. 4294967295_8
91 logical, parameter :: test_re1_8 = maskr(63, 8) .EQ. 9223372036854775807_8
92 logical, parameter :: test_re_8 = maskr(64, 8) .EQ. -1_8
93 logical, parameter :: test_ro_8 = maskr(65, 8) .EQ. -1_8
95 logical, parameter :: test_r0_16 = maskr(0, 16) .EQ. 0_16
96 logical, parameter :: test_r1_16 = maskr(1, 16) .EQ. 1_16
97 logical, parameter :: test_r2_16 = maskr(2, 16) .EQ. 3_16
98 logical, parameter :: test_rm_16 = maskr(64, 16) .EQ. 18446744073709551615_16
99 logical, parameter :: test_re1_16 = maskr(127, 16) .EQ. 170141183460469231731687303715884105727_16
100 logical, parameter :: test_re_16 = maskr(128, 16) .EQ. -1_16
101 logical, parameter :: test_ro_16 = maskr(129, 16) .EQ. -1_16
102 end module maskrtest