[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / pointer-signext.c
blob9900a6d4251c46fa7547d807623a31c857dfc5e3
1 // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -O2 -o - %s | FileCheck %s
3 // Under Windows 64, int and long are 32-bits. Make sure pointer math doesn't
4 // cause any sign extensions.
6 // CHECK: [[P:%.*]] = add i64 %param, -8
7 // CHECK-NEXT: [[Q:%.*]] = inttoptr i64 [[P]] to ptr
8 // CHECK-NEXT: load i64, ptr [[Q]]
10 #define CR(Record, TYPE, Field) \
11 ((TYPE *) ((unsigned char *) (Record) - (unsigned char *) &(((TYPE *) 0)->Field)))
13 typedef struct _LIST_ENTRY {
14 struct _LIST_ENTRY *ForwardLink;
15 struct _LIST_ENTRY *BackLink;
16 } LIST_ENTRY;
18 typedef struct {
19 unsigned long long Signature;
20 LIST_ENTRY Link;
21 } MEMORY_MAP;
23 int test(unsigned long long param)
25 LIST_ENTRY *Link;
26 MEMORY_MAP *Entry;
28 Link = (LIST_ENTRY *) param;
30 Entry = CR (Link, MEMORY_MAP, Link);
31 return (int) Entry->Signature;