Skip to content

Commit d65a709

Browse files
committed
Add some as1 and vector tests
1 parent 57453ba commit d65a709

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

llvm/test/Assembler/flags.ll

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
; RUN: verify-uselistorder %s
33

44
@addr = external global i64
5+
@addr_as1 = external addrspace(1) global i64
56

67
define i64 @add_unsigned(i64 %x, i64 %y) {
78
; CHECK: %z = add nuw i64 %x, %y
@@ -360,38 +361,60 @@ define ptr @gep_nuw_nusw_inbounds(ptr %p, i64 %idx) {
360361
ret ptr %gep
361362
}
362363

363-
define ptr @const_gep_nuw(ptr %p, i64 %idx) {
364+
define ptr addrspace(1) @gep_nusw_nuw_as1(ptr addrspace(1) %p, i64 %idx) {
365+
; CHECK: %gep = getelementptr nusw nuw i8, ptr addrspace(1) %p, i64 %idx
366+
%gep = getelementptr nusw nuw i8, ptr addrspace(1) %p, i64 %idx
367+
ret ptr addrspace(1) %gep
368+
}
369+
370+
define <2 x ptr> @gep_nusw_nuw_vec(<2 x ptr> %p, i64 %idx) {
371+
; CHECK: %gep = getelementptr nusw nuw i8, <2 x ptr> %p, i64 %idx
372+
%gep = getelementptr nusw nuw i8, <2 x ptr> %p, i64 %idx
373+
ret <2 x ptr> %gep
374+
}
375+
376+
define ptr @const_gep_nuw() {
364377
; CHECK: ret ptr getelementptr nuw (i8, ptr @addr, i64 100)
365378
ret ptr getelementptr nuw (i8, ptr @addr, i64 100)
366379
}
367380

368-
define ptr @const_gep_inbounds_nuw(ptr %p, i64 %idx) {
381+
define ptr @const_gep_inbounds_nuw() {
369382
; CHECK: ret ptr getelementptr inbounds nuw (i8, ptr @addr, i64 100)
370383
ret ptr getelementptr inbounds nuw (i8, ptr @addr, i64 100)
371384
}
372385

373-
define ptr @const_gep_nusw(ptr %p, i64 %idx) {
386+
define ptr @const_gep_nusw() {
374387
; CHECK: ret ptr getelementptr nusw (i8, ptr @addr, i64 100)
375388
ret ptr getelementptr nusw (i8, ptr @addr, i64 100)
376389
}
377390

378391
; inbounds implies nusw, so the flag is not printed back.
379-
define ptr @const_gep_inbounds_nusw(ptr %p, i64 %idx) {
392+
define ptr @const_gep_inbounds_nusw() {
380393
; CHECK: ret ptr getelementptr inbounds (i8, ptr @addr, i64 100)
381394
ret ptr getelementptr inbounds nusw (i8, ptr @addr, i64 100)
382395
}
383396

384-
define ptr @const_gep_nusw_nuw(ptr %p, i64 %idx) {
397+
define ptr @const_gep_nusw_nuw() {
385398
; CHECK: ret ptr getelementptr nusw nuw (i8, ptr @addr, i64 100)
386399
ret ptr getelementptr nusw nuw (i8, ptr @addr, i64 100)
387400
}
388401

389-
define ptr @const_gep_inbounds_nusw_nuw(ptr %p, i64 %idx) {
402+
define ptr @const_gep_inbounds_nusw_nuw() {
390403
; CHECK: ret ptr getelementptr inbounds nuw (i8, ptr @addr, i64 100)
391404
ret ptr getelementptr inbounds nusw nuw (i8, ptr @addr, i64 100)
392405
}
393406

394-
define ptr @const_gep_nuw_nusw_inbounds(ptr %p, i64 %idx) {
407+
define ptr @const_gep_nuw_nusw_inbounds() {
395408
; CHECK: ret ptr getelementptr inbounds nuw (i8, ptr @addr, i64 100)
396409
ret ptr getelementptr nuw nusw inbounds (i8, ptr @addr, i64 100)
397410
}
411+
412+
define ptr @const_gep_nuw_inrange() {
413+
; CHECK: ret ptr getelementptr nuw inrange(-8, 16) (i8, ptr @addr, i64 100)
414+
ret ptr getelementptr nuw inrange(-8, 16) (i8, ptr @addr, i64 100)
415+
}
416+
417+
define ptr addrspace(1) @const_gep_nusw_nuw_as1() {
418+
; CHECK: ret ptr addrspace(1) getelementptr nusw nuw (i8, ptr addrspace(1) @addr_as1, i64 100)
419+
ret ptr addrspace(1) getelementptr nusw nuw (i8, ptr addrspace(1) @addr_as1, i64 100)
420+
}

0 commit comments

Comments
 (0)