1// RUN: %clang -cc1 -triple x86_64-linux-pc -O3 -disable-llvm-passes %s -emit-llvm -o - | FileCheck %s
2
3void Shifts(_ExtInt(12) E, int i) {
4  E << 99;
5  // CHECK: shl i12 %{{.+}}, 3
6
7  77 << E;
8  // CHECK: %[[PROM:.+]] = zext i12 %{{.+}} to i32
9  // CHECK: %[[MASK:.+]] = and i32 %[[PROM]], 31
10  // CHECK: shl i32 77, %[[MASK]]
11
12  E << i;
13  // CHECK: %[[PROM:.+]] = trunc i32 %{{.+}} to i12
14  // CHECK: %[[MASK:.+]] = urem i12 %[[PROM]], 12
15  // CHECK: shl i12 %{{.+}}, %[[MASK]]
16
17  i << E;
18  // CHECK: %[[PROM:.+]] = zext i12 %{{.+}} to i32
19  // CHECK: %[[MASK:.+]] = and i32 %[[PROM]], 31
20  // CHECK: shl i32 %{{.+}}, %[[MASK]]
21}
22